首先需要下载urlrewritefilter-4.0.3.jar
本人已上传到csdn免费下载:http://download.csdn.net/detail/qianquan3/7904549
将urlrewritefilter-4.0.3.jar 放入lib目录下,同时
在WEB-INF目录下新建 urlrewrite.xml
内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<urlrewrite>
<rule>
<from>/index.html</from>
<to>/index.jsp</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>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
重启服务,大功告成!