strut2、urlrewrite3.2 404异常解决方案

    使用struts2.3.4、urlrewrite3.2整合做页面静态化的时候,url地址映射都是正确的,可是就是一直报404错误... 

    一直都没法解决 今天偶然发现一帖子终于解决了该问题

 

     strtus2的filter-mapping一定要添加:<dispatcher>FORWARD</dispatcher>

     正确配置如下:

 

    注意:urlrewrite的filter在struts2的filter之前!

   web.xml

 

    <filter>
		<filter-name>UrlRewriteFilter</filter-name>
		<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
	</filter>
        <filter>
		<filter-name>struts2Filter</filter-name>
		<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
	</filter>

    <filter-mapping>
		<filter-name>UrlRewriteFilter</filter-name>
		<url-pattern>/*</url-pattern>
		<dispatcher>REQUEST</dispatcher>  
	    <dispatcher>FORWARD</dispatcher>  
	</filter-mapping>

    <filter-mapping>
		<filter-name>struts2Filter</filter-name>
		<url-pattern>*.action</url-pattern>
	    <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>  
	</filter-mapping>   
 

 

 

附:http://pengyajie.iteye.com/blog/911326

你可能感兴趣的:(urlrewrite)