自己的网站快做完了,发现首页显示的时候总是跳转到http://www.xxxxxx.com/index.do
而我想让http://www.xxxxxx.com/ 这样的方式来访问,不想带有后边的index.do
首先想到的是在web.xml加上欢迎页:
<welcome-file-list>
<welcome-file>/index.jsp</welcome-file>
</welcome-file-list>
在index.jsp中:
<%@ page contentType="text/html;charset=utf-8" %>
<html>
<header>
<jsp:forward page="index.do" />
</header>
</html>
但是这个时候并没有达到效果,还需要在web.xml里的struts过滤器里加上:
<filter-mapping>
<filter-name>struts</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
此时启动程序,http://www.xxxxxx.com/就默认访问index.do了