给系统加url重写,urlrewriter. http://www.tuckey.org/

1.官网地址为:http://www.tuckey.org/

2. 在web.xml中加入如下内容:

<filter>
  <filter-name>UrlRewriteFilter</filter-name>
  <filter-class>test.UrlRewriteFilter</filter-class>
 </filter>
 <filter-mapping>
  <filter-name>UrlRewriteFilter</filter-name>
  <url-pattern>/*</url-pattern>
  <dispatcher>REQUEST</dispatcher>
 </filter-mapping>

 <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>
  <dispatcher>REQUEST</dispatcher>
  <dispatcher>FORWARD</dispatcher>
 </filter-mapping>

 

3.导入urlrewritefilter包.增加urlrewrite.xml 文件到web-inf 下.

 

4.要注意dispatcher的确当配置.

你可能感兴趣的:(urlrewrite)