【发布时间】:2023-01-08 11:50:00
【问题描述】:
自从迁移到 Java 17 和 Spring Boot 3 以来,我一直遇到 JSP 问题。我知道我们需要使用 jakarta.* 而不是 javax.*,但我是否遗漏了什么?我正在使用 Spring Tools 4,并且只是使用 JSP 运行一个基本的 Web 应用程序。使用以下依赖项时
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jakarta.servlet.jsp.jstl</artifactId>
</dependency>
项目运行,但出现以下错误
The superclass "javax.servlet.http.HttpServlet", determined from the Dynamic Web Module facet version (2.5), was not found on the Java Build Path
我可以通过添加 javax servlet 依赖项来摆脱它
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
但这与在 Spring Boot 3 中使用 javax.* 依赖项背道而驰。
我已阅读这些文章并尝试添加 jakarta.servlet.jsp 依赖项但没有成功。
【问题讨论】:
标签: spring-boot maven jsp jakarta-ee dependencies