struts2 , Не удалось выполнить действие: / newAction Нет действия, сопоставленного для имени действия newAction. - [неизвестное местоположение] - PullRequest
0 голосов
/ 10 апреля 2020

struts2 ould Не удалось выполнить действие: / newAction Нет действия, сопоставленного для имени действия newAction. - [неизвестное местоположение]

Каталог и информация об ошибках

Directory and error information

Файлы выглядят следующим образом, я не знаю, почему так будет. Пожалуйста, я почти сумасшедший.

<%--new.jsp--%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
    <title>new.jsp</title>
</head>
<body>
new
<s:action name="newAction"/>
</body>
</html>
<%-- a.jsp--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
a
</body>
</html>
<%!--struts2.xml--%>
<struts>
  <constant name="struts.enable.DynamicMethodInvocation" value="true"/>
  <constant name="struts.devMode" value="true"/>
  <package name="homework6" extends="struts-default">
    <action name="newAction" class="homework6.action.NewAction">
      <result name="success">/a.jsp</result>
    </action>
  </package>
</struts>
//NewAction
package homework6.action;

import com.opensymphony.xwork2.ActionSupport;

public class NewAction extends ActionSupport {
    @Override
    public String execute() throws Exception {
        return SUCCESS;
    }
}

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
         version="4.0">
    <display-name>default</display-name>
    <welcome-file-list>
        <welcome-file>new.jsp</welcome-file>
        <welcome-file>a.jsp</welcome-file>
    </welcome-file-list>
    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</web-app>

1 Ответ

0 голосов
/ 13 апреля 2020

См. распорки. xml раздел документации "Начало работы".

Имя по умолчанию для файла конфигурации Struts 2: struts.xml.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...