tomcat使用

 修改端口号

  * 修改端口号,%CATALANA_HOME%confserver.xml,修改<Connector port="8080">,把8080修改了即可。
  * http协议默认端口为80,也就是说http://localhost,等同与http://localhost:80


  如果把Tomcat端口号修改成80,那么访问服务器就可以无需再给出端口号。

外部应用既是把应用程序不放到Tomcat的wabapps目录下!而已放在外面,例如:F:/hello

二种方法:

1. 在conf/server.xml下配置,指定外部应用的路径。


<Host name="localhost" appBase="webapps"
      unpackWARs="true" autoDeploy="true">
      <Context path="cast_hello" docBase="F:/hello"/>
</Host>


  * 在<Host>元素下添加<Context>元素,path为URL访问路径,docBase为外部应用的真实目录。
  * 在浏览器地址栏中访问:http://localhost:8080/cast_hello/index.html

2. 在conf/catalana/localhost下添加配置文件,指定外部应用路径
  * 在conf/catalana/localhost目录下创建cast_hello.xml文件,其中cast_hello就是URL访问路径
  * 在cast_hello.xml文件中添加:<Context docBase="F:/hello"/>,docBase指定外部应用的目录。

3. 缺省web应用
  * 在webapps目录下有一个ROOT目录,它是缺省web应用,访问这个应用的路径:http://localhost:8080/index.jsp
  * 如果把web应用的内部放到webapps/ROOT下,访问URL路径中不用给出应用名称。
  path='' ''

web项目打开的默认页面

修改配置web.xml文件

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

原文地址:https://www.cnblogs.com/zdcsmart/p/11896097.html