社区版 IDEA 开发webapp 配置tomcat

1.安装tomcat

参考Tomcat配置_tomcat怎么配置成功-CSDN博客

2.构建webapp项目结构

新建一个普通项目

然后添加webapp的目录结构:

main目录下新建 webapp 文件夹

webapp文件夹下新建WEB_INF文件夹

*WEB_INF目录下新建web.xml

wenapp文件夹下再新建index.html

test目录下新建resources

web.xml内容

XML 复制代码
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="4.0"
         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_4_0.xsd">
    <display-name>xss</display-name>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>
</web-app>

index.html

html 复制代码
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>检测是否成功</title>
</head>
<body>
<h3>Hello</h3>
</body>
</html>

3.安装tomcat插件

4.配置tomcat

Name: 随便写

Deployment directory: 选到你的项目的webapp目录

Context path: 你访问网页的路径,可以就写 "/"

5.添加tomcat包依赖

选择你本地的tomcat安装包下的lib

5.运行

相关推荐
江湖中的阿龙1 分钟前
23种设计模式
java·开发语言·设计模式
可可嘻嘻大老虎3 分钟前
SpringBoot拦截器防重复提交实战
java·spring boot·后端
问心无愧05133 分钟前
ctf show web入门100
android·ide·笔记·android studio
RainCityLucky8 分钟前
Java Swing 自定义组件库分享(十一)
java·笔记·后端
ch.ju8 分钟前
Java Programming Chapter 4——The set method assigns a value to the property.
java·开发语言
Sam_Deep_Thinking9 分钟前
SaaS多租户业务差异化:扩展点机制的设计与实现
java·架构
我登哥MVP12 分钟前
Spring Boot 从“会用”到“精通”:Rest风格原理
java·spring boot·后端·spring·maven·intellij-idea·mybatis
love_muming14 分钟前
数据结构入门:栈与队列详解
java·开发语言·数据结构
我登哥MVP15 分钟前
Spring Boot 从“会用”到“精通”:静态资源原理
java·spring boot·后端·spring·tomcat·maven·intellij-idea
奋斗的袍子00716 分钟前
springboot集成国密算法SM2
java·spring boot·算法