配置 Facets 和 Aritfact
Facets 用于配置 Module
Facets 内点击 “+”,Add -> Web,选择 Module:自动在根目录下创建 web 文件
及 web\WEB-INF\web.xml
Artifact : Module 打包的方式,打包后的文件,在 Output directory 下生成
- Web Application Exploded:以文件夹形式(War Exploded)发布项目
- Web Application Archive,以 war 包的形式发布项目,每次编译会重新打包
配置 Tomcat
Application context:决定访问路径,可以为空(即 url 中不加项目名称)
注意 Deplyment 下的 Application context 是否和 Server 中的 Url 匹配,否则要输入如 /untitled1_Web_exploded 之类的,很麻烦
测试
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api