当前位置:网站首页>如何创建一个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项目。之后的学习内容将持续更新!!!
边栏推荐
- Go开发工具GoLand V2022.2 来了——Go 工作区重大升级
- Bytebase database schema change management tool
- CAS:122567-66-2_DSPE-生物素_DSPE-Biotin
- CAS:908007-17-0_Biotin-azide_Biotin azide
- UVa 10003 - Cutting Sticks (White Book, Interval DP)
- for循环练习题
- CAS: 773888-45-2_BIOTIN ALKYNE_Biotin-alkynyl
- CAS:908007-17-0_Biotin-azide _生物素叠氮化物
- 483. Smallest Good Base
- L2-041 插松枝
猜你喜欢
随机推荐
2022-08-03 oracle执行慢SQL-Q17对比
DO280管理和监控OpenShift平台--资源限制
HCIP第十六天
Research status of target detection at home and abroad
Teach a Man How to Fish - How to Query the Properties of Any SAP UI5 Control by Yourself Documentation and Technical Implementation Details Demo
CAS:1797415-74-7_TAMRA-Azide-PEG-Biotin
Unification of east-west and north-south communications
2019年10月SQL注入的两倍
E-commerce data warehouse ODS layer-----log data loading
How to deal with commas in the content of the CSV file of the system operation and maintenance series
斩获双奖|易知微荣获“2021中国数字孪生解决方案优秀供应商”“中国智能制造优秀推荐产品”双奖项!
【刷题篇】二叉树的右视图
376. Wiggle Subsequence
易基因|RNA m5C甲基化测序(RNA-BS)技术介绍
深度学习和机器学习有什么区别?
start with connect by implements recursive query
Data_web(九)mongodb增量同步到mongodb
嵌入式系统:概述
[MySQL Advanced] Creation and Management of Databases and Tables
CAS:1620523-64-9_Azide-SS-biotin_生物素-二硫-叠氮