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>
相关推荐
Caarlossss3 小时前
mybatis
java·数据库·tomcat·maven·mybatis·mybatis-spring
晓131312 小时前
后端篇——第一章 Maven基础全面教程
java·maven
wa的一声哭了13 小时前
内积空间 内积空间二
java·开发语言·python·spring·java-ee·django·maven
晓131313 小时前
后端篇——第二章 Maven高级全面教程
java·maven
中年程序员一枚1 天前
Springboot使用maven编译报juh-3.2.1.jar缺失
spring boot·maven·jar
哆la不懂a梦2 天前
测试1233211
maven
小肖爱笑不爱笑2 天前
Maven
java·log4j·maven
FreeBuf_2 天前
攻击者伪造Jackson JSON库入侵Maven中央仓库
java·json·maven
飞舞花下2 天前
MAVEN私有仓库配置-Nexus私有仓库
xml·java·maven
while(1){yan}2 天前
使用HuTool实现验证码
spring boot·spring·java-ee·maven