Maven之Servlet 版本问题

maven-archetype-webapp 骨架的 Servlet 版本问题

通过 maven-archetype-webapp 骨架去创建 java web 项目时,自动生成的 web.xml 配置文件所使用的 Servlet 的版本比较低(2.3),而在低版本的 Servlet 中 EL 表达式默认是关闭的。

通常,我们使用的 Servlet 至少会是 3.1

Servlet 3.1 版本的 web.xml

xml 复制代码
<?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">

  <display-name>Servlet 3.1 Web Application</display-name>  
  
</web-app>

Servlet 4.0 版本的 web.xml

xml 复制代码
<?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_4_0.xsd" 
  version="4.0" >
        
  <display-name>Servlet 4.0 Web Application</display-name>  

</web-app>
相关推荐
叶 落2 天前
[Maven 基础课程]再看下第一个 Maven 项目
maven·maven 入门·maven 基础课程
开开心心_Every2 天前
免费语音合成工具:66种音色随心选
人工智能·面试·java-ee·计算机外设·电脑·maven·excel
wangmengxxw2 天前
Maven的介绍及基本使用
java·maven
坚持每天敲代码3 天前
【教程】IDEA中导入springboot-maven工程
java·maven·intellij-idea
祈祷苍天赐我java之术3 天前
Maven 从入门到精通
java·maven
令狐少侠20113 天前
maven settings.xml文件的各个模块、含义以及它们之间的联系
xml·maven
栗子~~3 天前
bat脚本- 将jar 包批量安装到 Maven 本地仓库
java·maven·jar
Mr.Entropy3 天前
ecplise配置maven插件
java·maven
华农第一蒟蒻5 天前
Elasticsearch赋能3D打印机任务统计分析
java·大数据·spring boot·后端·elasticsearch·adb·maven
zhong liu bin6 天前
maven【maven】技术详解
java·ide·python·spring·maven·intellij-idea