如何指定tomcat下的某个项目的具体文件为网站的首页面
2016-08-23 22:27
316 查看
比如首页为: webapps/test/main.jsp
1.修改$tomcat/conf/server.xml文件。
在server.xml文件中,有一段如下:
……
<engine name="Catalina" defaultHost="localhost">
<host name="localhost" appBase="webapps"
unpackWARs="true"
xmlValidation="false" xmlNamespaceAware="false">
……
<host>
</engine>
……
在<host></host>标签之间添加上:
<Context path="" docBase="test" debug="0" reloadable="true" />
path 指的是虚拟路径,如果为空,表示是: http://域名
如果为“abc”,则表示访问地址为: http://域名/abc
docBase是虚拟目录的路径,可以写绝对路径,也可以写相对路径,相对路径指的是webapps下的项目名。
2.修改$tomcat/conf/web.xml文件。
在web.xml文件中,有一段如下:
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
在<welcome-file-list>与<welcome-file>index.html</welcome-file>之间添加上:
<welcome-file>main.jsp</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
3.重启tomcat后,可以直接访问:http://域名
1.修改$tomcat/conf/server.xml文件。
在server.xml文件中,有一段如下:
……
<engine name="Catalina" defaultHost="localhost">
<host name="localhost" appBase="webapps"
unpackWARs="true"
xmlValidation="false" xmlNamespaceAware="false">
……
<host>
</engine>
……
在<host></host>标签之间添加上:
<Context path="" docBase="test" debug="0" reloadable="true" />
path 指的是虚拟路径,如果为空,表示是: http://域名
如果为“abc”,则表示访问地址为: http://域名/abc
docBase是虚拟目录的路径,可以写绝对路径,也可以写相对路径,相对路径指的是webapps下的项目名。
2.修改$tomcat/conf/web.xml文件。
在web.xml文件中,有一段如下:
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
在<welcome-file-list>与<welcome-file>index.html</welcome-file>之间添加上:
<welcome-file>main.jsp</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
3.重启tomcat后,可以直接访问:http://域名
相关文章推荐
- 指定tomcat具体的某个项目文件为主页面
- 在eclipse中如何在大量项目中查找指定文件
- 如何打开没有*.sln工程文件的asp.net网站项目以及各种.net环境的项目
- IntelliJ IDEA运行tomcat项目编码错误, 及如何指定tomcat编码
- tomcat部署项目,指定设置项目的配置文件路径
- 在eclipse中如何在大量项目中查找指定文件
- 在eclipse中如何在大量项目中查找指定文件
- 如何找tomcat里发布的项目文件的路径
- 在eclipse中如何在大量项目中查找指定文件
- 在eclipse中如何在大量项目中查找指定文件(转载)
- j2ee网站项目首页如何直接使用action
- 如何用eclipse在大量项目中查找指定文件或关键字
- 如何让tomcat输入http://localhost直接进入我指定项目的文件夹里面
- Tomcat配置文件---配置访问指定路径下的项目
- vs2005中如何发布网站及打包web项目生成安装文件【转】
- MyEclipse中开发网站项目如何设置关联的Tomcat服务器热启动,即修改项目源代码时不需要每次都重启Tomcat
- Tomcat6.0.x怎样重新配置他的工作路径(虚拟路径)或如何在地址栏输入http://localhost/xxx直接进入我指定项目的文件夹
- dedecms如何随机调用指定分类下的文章到网站首页
- 如何配置tomcat项目的默认页面为.action或其他后缀名的方法(文件)
- maven项目如何生成war文件并部署到tomcat