wwwtuckeyorg/urlrewrite/ 下載URL Rewrite JAR包
將jar包復制到項目WEBINF/webxml 下
在webxml中配置URL Rewrite代碼如下
<filter>
<filtername>UrlRewriteFilter</filtername>
<filterclass>orgtuckeywebfiltersurlrewriteUrlRewriteFilter</filterclass>
</filter>
<filtermapping>
<filtername>UrlRewriteFilter</filtername>
<urlpattern>/*</urlpattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filtermapping>
添加偽靜態映射規則urlrewritexml
<?xml version="" encoding="GBK"?>
<!DOCTYPE urlrewrite PUBLIC "//tuckeyorg//DTD UrlRewrite //EN"
"
<urlrewrite>
<rule>
<! 所有配置如下正則表達式的請求 >
<from>/hellotaghtml</from>
<! 將被forward到如下JSP頁面其中$代表
上面第一個正則表達式所匹配的字符串 >
<to type="forward">/hellotagjsp</to>
</rule>
</urlrewrite>
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/19863.html