今天想在项目中用urlrewrite进行地址伪静态,我用的是ssh,我都照以前配置好了,可是我怎么访问都是404,可是我要是把跳转的action改成jsp页面就好了。。。。。郁闷!
web.xml 配置:
<!-- urlrewrite -->
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter
</filter-class>
<init-param>
<param-name>logLevel</param-name>
<param-value>WARN</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
后来找了好多资料。。。
最后找到原因:
原来用org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter Struts2过滤器需要加点东西
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/struts/*</url-pattern>
<dispatcher>REQUEST </dispatcher>
<dispatcher>FORWARD </dispatcher>
<dispatcher>INCLUDE </dispatcher>
</filter-mapping>
至于原因嘛,大家自己搜