jsp设置默认主页
方法一:(适合对服务器中单个站点的设置)
(d:\demo\为站点根目录)
在Tomcat中,默认主页为:index.html,index.htm,index.jsp
如果需要使用其他页面作为默认主页,需要配置WEB-INF文件夹下的web.xml文件:
如上例中:
在项目文件夹\WEB-INF\文件夹中建立文件web.xml:
内容如下:
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
login.jsp
方法二:(以下设置将应用于该服务器下所有的站点)推荐使用
打开文件%Toncat%/conf/web.xml,找到这段代码:
index.html
index.htm
index.jsp
在中间加入你想要的文件名即可。
如:我想让hello.jsp成为默认首页,我将上面那段代码改成:
hello.jsp
index.html
index.htm
index.jsp