The error 404 means that resource you have requested is not available, the same referred to the action that is didn't map to the request URL.
FilterDispatcher
is deprecated and may not work with the current Struts version, use StrutsPrepareAndExcecuteFilter
instead.
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
in the struts.xml
add the following
<package name="default" extends="struts-default" namespace="/">
<action name=""><result>/Login.jsp</result></acton>
this will forward you to the login page. Also consider to use absolute paths to the JSP resources.
In the JSP use the form that needs to rewrite to
<s:form namespace="/" action="login" method="post">
<s:textfield name="username" key="label.username" size="20" />
<s:password name="password" key="label.password" size="20" />
<s:submit key="label.login" align="center" />
</s:form>
In the action
attribute use the action name and provide namespace
as you did in the package configuration.
Using method="execute"
is useless in the s:submit
tag, the method execute
used by default, and it will not work because you have turned off DMI in the Struts configuration.
Adding libraries over the old libraries in the WEB-INF/lib
doesn't help so much and your application probably would not work, until you remove and replace all lower version libraries with higher version and add new libraries needed by the current version of Struts framework.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…