URL pattern issue with struts 1.x and Struts 2.x



One of my project is running on Struts 1.x and We are trying to integrate few of URL's pattern on struts 2.x. Few URL also end with Abc.do .


Currently Web.xml looks like--



<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
</servlet>

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


And above pattern working fine as defined in web.xml.


Now we have added in web.xml to support struts 2.x parallely.



<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>*.action</url-pattern>
</filter-mapping>


After added above info in web.xml , those URL pattern ends with .action they are also working fine using struts 2.x.


But when we want to add few specific URL pattern which also ends with .do mapped to Struts 2.x as below.



<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/Hello.do</url-pattern>
</filter-mapping>


We want all request which starts with Hello*.do should mapped on struts 2.x , but right now this is not happening.


So is am something missing here in web.xml or Altogether it is not possible.


Is there any way apart we can solve this issue.


-Thanks Anil Singh


No comments:

Post a Comment