tomcat 直接localhost:8080访问项目

1.修改server.xml文件 
注意,这里的server.xml不是在javaee里面servers项目里面的那个,是安装tomcat的文件夹里面conf/server.xml 
比如:E:\apache-tomcat-6.0.43\conf\

<Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">

        <Context path="" docBase="Demo" reloadable="true" />

      </Host>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

增加了<Context path="" docBase="Demo" reloadable="true" />

本地和网上Linux发布不同,此资料适用Linux发布

docBase这里面只能有项目名,不能携带具体文件如demo/jsp

2.有了项目,就要设置具体的页面(html,jsp,等) 
错误的→(在相同的conf/下面找到web.xml) 
正确的→(项目里面的web.xml)

<welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
  • 1
  • 2
  • 3
  • 4
  • 5

设置项目的开始页面!

附加:这里写图片描述

最重要一点忘记说了,改完要重启服务,不能再javaee里面重启,得在 
E:\apache-tomcat-6.0.43\bin(tomcat安装目录) startup.bat重启

资料来源: 
http://www.cnblogs.com/icerainsoft/archive/2012/11/08/2760848.html

猜你喜欢

转载自blog.csdn.net/qq_24800377/article/details/80252820