社区版 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.运行

相关推荐
從南走到北3 分钟前
JAVA同城信息付费系统家政服务房屋租赁房屋买卖房屋装修信息发布平台小程序APP公众号源码
java·开发语言·小程序
TechMasterPlus14 分钟前
java:单例模式
java·开发语言·单例模式
JIngJaneIL26 分钟前
远程在线诊疗|在线诊疗|基于java和小程序的在线诊疗系统小程序设计与实现(源码+数据库+文档)
java·数据库·vue.js·spring boot·小程序·毕设·在线诊疗小程序
will_we26 分钟前
Spring Boot4正式篇:第二篇 多版本API特性
java·后端
风筝在晴天搁浅27 分钟前
代码随想录 70.爬楼梯
java
好好研究28 分钟前
SpringMVC框架 - 文件上传
java·spring·mvc·idea
摇滚侠34 分钟前
VsCode 自带的 Git 使用教程
ide·git·vscode
栗子~~38 分钟前
java-根据word模板灵活生成word文档-demo
java·开发语言·word
秃了也弱了。43 分钟前
testng:Java界功能强大的单元测试框架
java·单元测试·log4j
曾经的三心草1 小时前
JavaEE初阶-多线程2
android·java·java-ee