maven项目下JSTL表达式联系出现java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.jsp.index_jsp

转载自pruett的博客:http://blog.csdn.net/pruett/article/details/76966733

1.遇到问题

在学习springMVC的JSTL时,在index页面中写入<%@ taglib uri=”http://java.sun.com/jsp/jstl/core” prefix=”c”%>,并且加入了JSTL的jstl.jar和stander.jar,在maven命令下这两个jar包并没有加入到WEB-INF的lib目录下,在Tomcat服务器中加入之后,还是出现 java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.jsp.index_jsp或者The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application错误

2.问题分析

从网上查资料,说可能是servlet或者jsp-api的jar包冲突,

3.问题解决

在maven的pom.xml文件中加入如下两个dependency,问题解决,并且不需要加入上述的JSTL的jar包

<dependency>
  <groupId>org.glassfish.web</groupId>
  <artifactId>javax.servlet.jsp.jstl</artifactId>
  <version>1.2.4</version>
</dependency>
<dependency>
  <groupId>javax.servlet.jsp.jstl</groupId>
  <artifactId>javax.servlet.jsp.jstl-api</artifactId>
  <version>1.2.1</version>
</dependency>

猜你喜欢

转载自blog.csdn.net/AGambler/article/details/79081763