一、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"?> <urlrewrite> <rule> <note> </note> <from>^/([0-9A-Za-z]+)$</from> <to type="forward">/servlet/Test1?id=$1</to> </rule> </urlrewrite>
?