Xml Code
Index. jsp page:
<Jsp: forward page = "show. action"> </jsp: forward>
Configure struts. xml as follows:
<Package name = "struts2" extends = "struts-dafult">
<Action name = "show" class = "action. ShowAction">
<Result name = "showinfo">/showinfo. jsp </result>
</Action>
</Package>
Error 404 (show. action not found)
Cause:
The struts2 interceptor intercepts the forward request.
Solution:
Modify the web. xml file
Xml Code
<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>
To:
<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>
<Dispatcher> REQUEST </dispatcher>
<Dispatcher> FORWARD </dispatcher>
</Filter-mapping>
Author: Zhang Hui