最新更新 sitemap 网站制作设计本站搜索
网页设计
国外网站 韩国网站 个人主页 手提袋设计 CSS 网页特效 平面设计 网站设计 Flash CMS技巧 服装网站 php教程 photoshop 画册 服务器选用 数据库 Office
虚拟主机 域名注册 云主机 网页设计 客服QQ:8208442
当前位置:首页 > 编程开发 > jsp教程

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

日期:01-08    来源:中国设计秀    作者:cnwebshow.com

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

eZF中国设计秀
<?xml version=”1.0″ encoding=”UTF-8″?>eZF中国设计秀
<web-app version=”2.4″eZF中国设计秀
xmlns=”http://java.sun.com/xml/ns/j2ee”eZF中国设计秀
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”eZF中国设计秀
xsi:schemaLocation=”http://java.sun.com/xml/ns/j2eeeZF中国设计秀
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd“>eZF中国设计秀
<welcome-file-list>eZF中国设计秀
<welcome-file>hello.jsp</welcome-file>eZF中国设计秀
</welcome-file-list>eZF中国设计秀
</web-app>eZF中国设计秀

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

<welcome-file-list>eZF中国设计秀
<welcome-file>index.html</welcome-file>eZF中国设计秀
<welcome-file>index.htm</welcome-file>eZF中国设计秀
<welcome-file>index.jsp</welcome-file>eZF中国设计秀
</welcome-file-list>eZF中国设计秀

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

<welcome-file-list>eZF中国设计秀
<welcome-file>hello.jsp</welcome-file>eZF中国设计秀
<welcome-file>index.html</welcome-file>eZF中国设计秀
<welcome-file>index.htm</welcome-file>eZF中国设计秀
<welcome-file>index.jsp</welcome-file>eZF中国设计秀
</welcome-file-list>eZF中国设计秀

本文引用地址:/bc/article_46578.html
网站地图 | 关于我们 | 联系我们 | 网站建设 | 广告服务 | 版权声明 | 免责声明