views:

22

answers:

1

I have a Struts2 (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 the struts filter. I want to add a servlet in my web application. I want to send all requests with a certain url pattern to that servlet. I want everything else to go to my struts servlet.

I know I could only map "*.action" to the struts servlet, but I hate .action being on the end of all my URL's.

Can anyone help? Thanks in advance!

+1  A: 

In your struts.xml add:

<constant name="struts.action.excludePattern" value="/ServletToExcludeFromStruts*"/>

The value be comma delimited as well for multiple exclusions. See http://struts.apache.org/2.2.1/docs/webxml.html

Matt