jstl use the / jstl / core_rt and / jstl / core issues

<%@ page import="java.util.List" %>
<%@ page import="com.gfj.entiny.Student" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt/jstl/core"%>
<html>
<head>
    <title>Title</title>
</head>
<body>
    <c:forEach items="${stus}" var="stu" varStatus="ss">
        ${stu.id},${stu.name},${stu.age},${stu.address}<br>
    </c:forEach>
<<br>
        </body>
</html>

This is a simple piece of code that can not be simple, the use of idea has been linked to tomcat error;

Type Exception Report

Message The absolute uri: http://java.sun.com/jstl/core_rt/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

As the error code, check the error for a long time and do not know, can not start.

The next day stumbled upon a project for the use of the tag library

uri="http://java.sun.com/jstl/core_rt/jstl/core_rt"

After trying to replace core_rt, successfully resolved.

The reason:
probably because of the use JSP2.0 version, at the same time, no alternate version of JSTL core library (RT Library)

There are two taglib directive JSTL core library, wherein the library that is dependent on the RT attribute values traditional request JSP, rather than relying on EL achieved (referred to as EL library .JSP2.0 support EL)
the JSP using < @ taglib uri = HTTP%: // the Java .sun.com / JSTL / Core prefix = "c"%> in version 2.3 can, in the 2.4 to die, which is caused by an incompatible version

and disparities exist 1.0 1.1 jstl, recommended by EL need in 1.1 version:
Use jstl1.1 only need
1.0 to

<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>

Replaced by:

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 
即可。

 

Guess you like

Origin www.cnblogs.com/gf-jie/p/11892007.html