Tomcat 的 Web 应用目录结构与文件

Web应用目录结构

<WebName>
    - WEB-INF
        - src/
        - classes/ (存放.class文件)
        - lib/ (存放.jar文件)
        - web.xml
    - index.jsp

Servlet 3 开始,WEB-INF路径下可以不包含web.xml

web.xml

<?xml version="1.0" encoding="UTF-8"?>

<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"
  metadata-complete="true">

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

</web-app>
posted @ 2022-01-23 21:07  MatroLeox  阅读(96)  评论(0编辑  收藏  举报