关于tomcat部署web服务方式

Posted on 2021-12-20 11:14  yacbo  阅读(37)  评论(0编辑  收藏  举报

 

方式1.apache-tomcat-8.0.47\webapps文件夹下放war包会自动解压。文件夹名称就是访问路径

 

方式2.apache-tomcat-8.0.47\conf\Catalina\localhost问价夹下创建news.xml,访问路径后面就是 www.localhost:8080/news

其中news.xml的内容 。

<Context docBase="D:\BackPhoto\news"/>

 其中D:\BackPhoto\news 下存放web资源,创建WEB-INF下新建web.xml文件,用来配置默认页面。

<?xml version="1.0" encoding="ISO-8859-1"?>

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
                      http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
  version="3.1">

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

</web-app>

  如下:www.localhost:8080/news  和  www.localhost:8080/news/a.html 等价。

Copyright © 2024 yacbo
Powered by .NET 8.0 on Kubernetes