我用的是urlrewrite-3.0.4,首先把包导入项目中,然后加上urlrewrite.xml,内容自己配置,例:<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.0//EN"
"http://tuckey.org/res/dtds/urlrewrite3.0.dtd">urlrewrite>
<rule>
<from>/test/(.*).html</from>
<to>/index.jsp?id=$1</to>
</rule>
</urlrewrite>
然后在web.xml加上过滤器, <filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>,
这样就可以,当运行,httP://localohost:8080/testUrl/test/a.html
那么会执行index.jsp代码,并把id传值.
如有问题留言青菜猫解决...
posted on 2007-10-17 22:55
青菜猫(孙宇) 阅读(734)
评论(1) 编辑 收藏