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>
相关推荐
请为小H留灯5 小时前
一键解决 IDEA 中 Java 项目变橙色的问题!!!
java·ide·maven·intellij-idea·java项目
看见代码就想敲12 小时前
java学习之(Maven pom.xml 详细讲解)
java·学习·maven
huohuopro14 小时前
Maven进阶
python·pycharm·maven
TlYf NTLE1 天前
Spring Boot spring-boot-maven-plugin 参数配置详解
spring boot·后端·maven
❀͜͡傀儡师2 天前
Maven Versions Plugin 使用指南
maven
ckm紫韵2 天前
Maven搭建私服Nexus教程
java·maven·nexus
福运常在2 天前
股票数据API(19)次新股池数据
java·python·maven
回到原点的码农2 天前
maven导入spring框架
数据库·spring·maven
人机与认知实验室2 天前
Maven与以色列福音系统有何区别?
java·maven
※DX3906※3 天前
SpringBoot之旅4: MyBatis 操作数据库(进阶) 动态SQL+MyBatis-Plus实战,从入门到熟练,再也不踩绑定异常、SQL拼接坑
java·数据库·spring boot·spring·java-ee·maven·mybatis