日期:2014-05-16  浏览次数:20371 次

jstl1.0和jstl1.1的区别
参考:http://www.cnblogs.com/beyondwcm/archive/2007/12/05/983213.html

这要从一个异常说起
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

原来是jstl的引入方式有问题,所在项目jsp是1.2,jstl是1.0,引入jstl的路径为:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>,这个路径是错误的,这是jstl1.1的引入路径,jstl1.0的引入路径uri少了‘jsp’这一层:
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>


我们需要在两个地方注意1.0和1.1的使用

一个是web.xml的头

JSTL1.1和JSP2.0
="2.4"
    xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">


JSTL1.0和JSP1.2

="2.3"
    xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
    http://java.sun.com/xml/ns/j2ee/web-app_2_3.xsd">




1.0引入方式

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

1.1引入方式

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