JSP伪静态的实现
需要一个urlrewrite.jar可以去http://tuckey.org/urlrewrite/ 下载
在web.xml中配置
<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>
</filter-mapping>
然后在WEB-INF下新建一个 urlrewrite.xml文件
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 2.6//EN" "http://tuckey.org/res/dtds/urlrewrite2.6.dtd">
<urlrewrite>
<!-- 匹配 http://www.xxx.com/demo123.html 至 http://www.xxx.com/demo123.jsp-->
<rule>
<from>^/([a-zA-Z0-9]+).html$</from>
<to>/$1.jsp</to>
</rule>
<!-- 匹配 http://www.xxx.com/demo123/xiao三/北京市haidian.html
至 http://www.xxx.com/demo123.jsp?name=xiao三&address=北京市海淀区
\u4e00-\u9fa5 匹配中文
-->
<rule>
<from>^/(\w+)/([a-z\u4e00-\u9fa5]+)/([a-z\u4e00-\u9fa5]+).asp$</from>
<to>/$1.jsp?name=$2&address=$3</to>
</rule>
</urlrewrite>
![](http://www.zhjie.net/wp-content/uploads/2012/12/1355392197.png)
来自:http://www.zhjie.net/jspjava-pseudo-static.htm