【JavaWeb】Tomcat_WebAPP的标准结构

在webapps目录下创建app目录

app目录下创建aaa.html

app目录下创建static目录,在static目录下创建如下三个目录


WEB-INF目录下的资源是受保护的资源,是不可以通过浏览器直接访问的资源

在app目录下创建WEB-INF目录

将图片放入该目录下,并在浏览器中访问,发现无法访问

将图片放在其他目录下,是可以访问的

在该目录下创建如下内容

web.xml文件内容如下:

css 复制代码
<?xml version="1.0" encoding="UTF-8"?>
<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee
                      https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd"
  version="6.0"
  metadata-complete="true">

</web-app>

总结

一个可以部署到tomcat/webapps中的,标准的app目录结构如下

或者

相关推荐
袁震4 小时前
HarmonyOS 应用包体积优化与上架自检实战:从 76.2MB 到 3.6MB
java·华为·性能优化·harmonyos
zcmodeltech5 小时前
反应装置模型控制系统设计与实现:多设备协同联动方案
java·网络·数据库·stm32·嵌入式硬件·能源·制造
码视野5 小时前
基于 Spring Boot + Vue3 的【城市地下燃气管网微泄漏感知与相邻地下空间燃爆预警中台】设计与实现(含PRD/三端高保真源码/大屏)
java·前端·人工智能·spring boot·后端
2601_962071575 小时前
数据库系统架构与DBMS功能探微:现代信息时代数据管理的关键
java·开发语言·数据库
梦想的旅途25 小时前
如何高效调用企业微信通讯录API管理组织架构
java·开发语言·企业微信
2601_962065256 小时前
2.启动mysql容器
java·数据库·mysql
2601_962065496 小时前
PHP For 循环
android·java·php
2601_962201726 小时前
Java进阶,集合,Colllection,常见数据结构
java·数据结构·windows
彷徨而立6 小时前
【C/C++】多线程读写普通 int 变量的一些问题
java·c语言·c++
卓怡学长6 小时前
w175基于springboot校园二手物品交易平台
java·spring boot·spring·maven·intellij-idea