使用JSP文件作为View资源来开发Spring MVC。
example.jsp
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<body>
<h1>Spring MVC web application</h1>
</body>
</html>
上面是一个简单的JSP页面,但是遇到了以下jstl错误?
SEVERE: Servlet.service() for servlet mvc-dispatcher threw exception
org.apache.jasper.JasperException:
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
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:116)
//...
解
默认情况下,jstl jar不包含在Spring框架中。 要解决此问题,请声明jstl依赖项,如下所示:
pom.xml
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
标签: jstl
翻译自: https://mkyong.com/spring-mvc/the-absolute-uri-httpjava-sun-comjspjstlcore-cannot-be-resolved/