Java – in addition to a servlet, it also filters the mapping of all content for struts 2?
•
Java
I have a struts 2 (2.1.8.1) web application My web XML looks like,
<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>
This is configured to map all requests to struts filters I want to add a servlet to my web application I want to send all requests with a specific URL pattern to the servlet I hope everything else can get into my struts servlet
I know I can only map "*. Action" to struts servlets, but I hate it Action is at the end of all my URLs
Solution
In your struts Add to XML:
<constant name="struts.action.excludePattern" value="/ServletToExcludeFromStruts*"/>
For multiple exclusions, the values are also separated by commas see http://struts.apache.org/2.2.1/docs/webxml.html
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码