如何设置Tomcat默认主页(指定欢迎页)?

作者:互联网

2009-07-03

JSP教程

方法一:(适合对服务器中单个站点的设置)
(d:demo为站点根目录)
在Tomcat中,默认主页为:index.html,index.htm,index.jsp
如果需要使用其他页面作为默认主页,需要配置WEB-INF文件夹下的web.xml文件:
如上例中:
在D:demoWEB-INF文件夹中建立文件web.xml:
内容如下:



xmlns=”http://java.*s*u*n.com/xml/ns/j2ee”
xmlns:xsi=”http://www.***w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=”http://java.s***un.com/xml/ns/j2ee
“>

hello.jsp

方法二:(以下设置将应用于该服务器下所有的站点)推荐使用
打开文件conf/web.xml,找到这段代码:


index.html
index.htm
index.jsp

在中间加入你想要的文件名即可。
如:我想让hello.jsp成为默认首页,我将上面那段代码改成:


hello.jsp
index.html
index.htm
index.jsp

相关标签:

JSP