当前位置:网站首页>如何创建一个Web项目
如何创建一个Web项目
2022-08-03 22:12:00 【一只咸鱼。。】
文章目录
提示:以下是本篇文章正文内容,Java系列学习将会持续更新
一、创建Web项目
Web项目是由Web服务器(如Tomcat)来控制管理我们的代码,项目中没有main方法,项目的启动和运行是由Tomcat进行的。
所以在进入Web学习之前,我们需要先下载安装tomcat,并进行环境变量配置
①可以直接选择压缩包下载并解压就行,省去了安装的麻烦。
②还需要进行环境变量的配置
③启动Tomcat后,就可以访问到 http://localhost:8080/ 地址了
1. 新建Maven工程

2. 在pom.xml中,添加servlet依赖
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
3. 创建web.xml文件
在src/main下面新建webapp目录,找一个web.xml放置在webapp/WEB-INF/下
<?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="false">
</web-app>
4. 通过tomcat配置启动项
①下载Smart Tomcat插件
②在启动项中配置tomcat,需要在IDEA中指定电脑中安装的tomcat的路径
5. 在webapp下创建html静态文件

启动项目,访问测试:http://localhost:8080/day1_first/hello.html
总结:
提示:这里对文章进行总结:
以上就是今天的学习内容,本文是JavaWeb的学习,学习如何创建一个Web项目。之后的学习内容将持续更新!!!
边栏推荐
- 2022年全国职业院校技能大赛网络安全 B模块 任务十windows操作系统渗透测试 国赛原题
- 21天打卡挑战学习MySQL——《Window下安装MySql》第一周 第三篇
- Gains double award | know micro easily won the "2021 China digital twin solution suppliers in excellence" "made in China's smart excellent recommended products" double award!
- 113. Teach a Man how to fish - How to query the documentation and technical implementation details of any SAP UI5 control property by yourself
- FVCOM 3D Numerical Simulation of Hydrodynamics, Water Exchange, Dispersion and Transport of Oil Spills丨FVCOM Model Watershed, Numerical Simulation Method of Marine Water Environment
- 目标检测的国内外研究现状
- 距LiveVideoStackCon 2022 上海站开幕还有3天!
- With 4 years of work experience, the 5 communication methods between multi-threads can't be said, can you believe it?
- Pay from 0 to 1
- CAS:122567-66-2_DSPE-Biotin_DSPE-Biotin
猜你喜欢
随机推荐
Golang第一章:入门
【day1】
CAS:122567-66-2_DSPE-Biotin_DSPE-Biotin
CAS: 773888-45-2_BIOTIN ALKYNE_生物素-炔基
Summary bug 】 【 Elipse garbled solution project code in Chinese!
HCIP第十五天
21天打卡挑战学习MySQL——《MySQL工具的使用》第一周 第二篇
全球观之地理部分
mysql如何将表结构导出到excel
CAS:1260586-88-6_生物素-C5-叠氮_Biotin-C5-Azide
Basic Concepts of Graphs
HCIP第十六天
Nine ways to teach you to read the file path in the resources directory
【bug】汇总Elipse项目中代码中文乱码解决方法!
『百日百题 · 基础篇』备战面试,坚持刷题 第四话——循环语句!
480. Sliding Window Median
数据一致性:双删为什么要延时?
Internet user account information management regulations come into effect today: must crack down on account trading and gray products
CAS: 1192802-98-4 _uv cracking of biotin - PEG2 - azide
如何基于WPF写一款数据库文档管理工具(二)








