Based on the popular and very useful mod_rewrite for apache, UrlRewriteFilter is a Java Web Filter for any J2EE compliant web application server (such as Resin, Orion or Tomcat), which allows you to rewrite URLs before they get to your code. It is a very powerful tool just like Apache's mod_rewrite.
URL rewriting is very common with Apache Web Server (see mod_rewrite's rewriting guide) but has not been possible in most java web application servers. The main things it is used for are:
UrlRewriteFilter uses an xml file, called urlrewrite.xml (it goes into the WEB-INF directory), for configuration. Most parameters
http://tuckey.org/urlrewrite/ 官方站点
http://code.google.com/p/urlrewritefilter/ goole code 目前下载已经移到这上面了。
下载urlrewrite-3.2.0.jar 并将其复制到WEB-INF/lib目录
基本上复制以下代码就可以了:
将用户访问的伪地址转成真实的地址。
访问from配置节,实际上访问的是to配置节
将页面上的真实地址,转换成伪地址,用此配置节,可以使程序和配置之间达到透明,程序唯一要做的是将要映射的地址
注意:<c:url 中不能将&换成&官方文档是错的!
注意:此配置?要换成/? &要换成&