个人工作经验! 如有不当之处,敬请指点
1.0 web -info 目录下建立 urlrewrite.xml 文件 类似如下:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE urlrewrite (View Source for full doctype...)>
- <urlrewrite>
- <rule enabled="true">
<from casesensitive="false">^/morednf.shtml</from>
<to type="forward" last="true" encode="default">/zxAction.do?method=searchByClassInit&DNFsign=yes</to>
</rule>
- <rule enabled="true">
<from casesensitive="false">^/15173back.shtml?([.]*)</from>
<to type="forward" last="true" encode="default">/cardFor15173Action.do?method=backCardInfo&$1</to>
</rule>
</urlrewrite>
2.0 在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>
3.0 加入 JAR 包
urlrewrite-2.6.0.jar
4.0 完了!
好戏在后面: 如果要配置两个参数 或者多个参数咋办?
<rule>
<from>^/IS ([\w]*).shtml?([.]*)</from>
<to type="forward">/aaaa.do?method=Search$1&$2</to>
</rule>
你是不是已经有想法了!
去动手吧! 呵呵!