When configuring struts2, the configuration in Web. XML is as follows:
1 < Filter > 2 < Filter-name > Struts2 </ Filter-name > 3 < Filter-class > Org. Apache. struts2.dispatcher. Ng. Filter. strutsprepareandexecutefilter</ Filter-class > 4 </ Filter > 5 < Filter-Mapping > 6 < Filter-name > Struts2 </ Filter-name > 7 < URL-Pattern > /* </ URL-Pattern > 8 </ Filter-Mapping >
The configuration of DWR in Web. XML is as follows:
1 < Servlet > 2 < Servlet-name > DWR-invoker </ Servlet-name > 3 < Servlet-class > Org. directwebremoting. servlet. dwrservlet </ Servlet-class > 4 < Init-Param > 5 < Param-name > Debug </ Param-name > 6 < Param-Value > True </ Param-Value > 7 </ Init-Param > 8 </ Servlet > 9 < Servlet-Mapping > 10 < Servlet-name > DWR-invoker </ Servlet-name > 11 < URL-Pattern > /DWR /* </ URL-Pattern > 12 </ Servlet-Mapping >
Struts2 uses/* as the URL-pattern. In the struts mechanism, as long as there is no suffix name in the Request Path or the suffix name is. Action, it is treated as an action. Therefore, after DWR is configured, The js method list exposed in the current system should be displayed after the class is clicked on the test page, display there is no action mapped for action... similar information is because after you click the class name link, the path does not have a suffix. There are two solutions:
(1) define in struts. properties:
Struts. Action. Extension = action
Because the default configuration of struts2 is:
Struts. Action. Extension = action (note that there is a comma next to it)
(2) set in struts. properties:
Struts. action. excludepattern =/DWR. *,/webeditor. * (Note: Here is a regular expression, not the URL matching mode. Therefore, write/DWR. * Instead of/DWR /*)
In this way, configure strutsprepareandexecutefilter. The filterdispatcher configuration is invalid.