Monday, August 2, 2010

Can Struts 1 & 2 coexist in the same web application?

The answer is yes, but in the web.xml file the Struts 1 servlet mapping and Struts 2 filter mapping need to be configured as follow so that Struts 1 and 2 will not be invoked on the same request:

Struts 1:
<servlet-mapping/>
   <servlet-name>action</servlet-name>
   <url-pattern>*.do</url-pattern>
</servlet-mapping>

Struts 2:
<filter-mapping>
   <filter-name>struts</filter-name>
   <url-pattern>*.action</url-pattern>
</filter-mapping>
Note that there is no slash before *.action in url-pattern element.

No comments:

Post a Comment