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" %>

相關文章
相關標籤/搜索