chenheping

原文:http://blog.csdn.net/jenson_/article/details/78063180

1.tomcat原来的默认根目录是http://localhost:8080,如果想修改访问的根目录,可以这样:

找到tomcat的server.xml(在conf目录下),找到:

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

在</Host>前插入:

<Context path="" docBase="/date/www/tomcat/" debug="0"/>

其中 /date/www/tomcat/ 就是我想设置的网站根目录,然后重启tomcat。

再次访问http://localhost:8080时,就是直接访问 /date/www/tomcat/ 目录下的文件了。


2.tomcat的web.xml(在conf目录下),在该文件中找到

  <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

这是tomcat默认的3个文件,当你输入指定路径后,tomcat会自动查找这3个页面。

如果你想让tomcat自动找到自己的页面,比如main.jsp。可以修改上面信息为:

<welcome-file-list>
        <welcome-file>main.jsp</welcome-file>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

 

   

修改完成!!!

 

分类:

技术点:

相关文章:

  • 2021-11-02
  • 2022-01-20
  • 2021-07-04
  • 2021-10-01
  • 2021-07-07
  • 2021-11-04
  • 2020-11-02
猜你喜欢
  • 2021-09-30
  • 2021-12-15
  • 2021-12-24
  • 2021-09-24
  • 2021-09-24
相关资源
相似解决方案