[英]Package javax.servlet.jsp error
I have an error in a .jsp file in my java ee project : package javax.servlet.jsp does not exist . 我的java ee项目中的.jsp文件中有一个错误: 包javax.servlet.jsp不存在 。 I have searched why and I found that with Maven, we need to add a dependency into the pom.xml. 我搜索了原因,发现使用Maven,我们需要在pom.xml中添加一个依赖项。 But I already have this dependency : 但是我已经有了这个依赖:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
When I build the project, it tells me "BUILD SUCCESSFUL" but I still have this error. 当我构建项目时,它告诉我“ BUILD SUCCESSFUL”,但我仍然遇到此错误。 Is there anything I need to add somewhere else please ? 我有什么需要补充的地方吗?
最终servlet-api.jar
应该在类路径中,即WEB-INF \\ lib文件夹下
Try this: 尝试这个:
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.