JSP中引入JSTL 报This absolute uri http://java.sun.c...

在JSP 页面中,引入<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>时,运行时,会报以下异常: html

org.apache.jasper.JasperException: java

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

解决办法: sql

1 查看JSTL的当前版本,是JSTL1.0 仍是JSTL1.1 。 apache

2 下载JSTL1.1   URL: http://jakarta.apache.org/taglibs/index.html app

3 解压 jakarta-taglibs-standard-current.zip jsp

4 将standard.jar and jstl.jar 放入项目的WEB-INFO的lib目录下 this

5 将tlb文件夹放入项目的WEB-INFO的目录下 spa

6 修改web.xml文件 code

<jsp-config>
    <taglib>
        <taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
        <taglib-location>/WEB-INF/tld/fmt.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
        <taglib-location>/WEB-INF/tld/c.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>http://java.sun.com/jstl/sql</taglib-uri>
        <taglib-location>/WEB-INF/tld/sql.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>http://java.sun.com/jstl/x</taglib-uri>
        <taglib-location>/WEB-INF/tld/x.tld</taglib-location>
    </taglib> 
  </jsp-config>

 

 7 在JSP页面中插入:

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

相关文章
相关标签/搜索