天天看點

關于JSP中org.apache.jasper.JasperException

關于JSP中org.apache.jasper.JasperException:

       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

從網上搜了一下,相同的說法是:一個就是JSTL的版本問題(1.0與1.1),是否不一緻。 還有就是檢查虛拟目錄下WEB-INF目錄下的lib檔案夾(如果同有lib檔案夾,後動建立一個)中是否有jstl.jar和standard.jar兩個jar包 ,如果沒有則把它們複制到lib下面。

       都試了,不過報錯依舊……後來又找了一下加上自己的亂搞,按照上面的改過之後,大體有兩種解決方法:

       第一種就是在Eclipse的工程中導入JSTL1.1後,下載下傳JSTL1.1  http://jakarta.apache.org/taglibs/index.html

然後解壓,把*.jar和*.tld放到/WEB-INF/lib目錄下。也就是将所有的jakarta-taglibs-standard-current.zip(JSTL的類庫)中的.jar和.tlb放到WEB-INF目錄下的 lib檔案夾中,JSP檔案中導入<%@ taglib prefix="c" uri="/WEB-INF/lib/c.tld" %>

第二種是修改web.xml,加上下面的語句:

<?xml version="1.0" encoding="UTF-8"?> 

<web-app version="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"> 

    <jsp-config> 

        <taglib> 

            <taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri> 

            <taglib-location>/WEB-INF/tlds/fmt.tld</taglib-location> 

        </taglib> 

        <taglib> 

            <taglib-uri>http://java.sun.com/jstl/fmt-rt</taglib-uri> 

            <taglib-location>/WEB-INF/tlds/fmt-rt.tld</taglib-location> 

        </taglib> 

        <taglib> 

            <taglib-uri>http://java.sun.com/jstl/core</taglib-uri> 

            <taglib-location>/WEB-INF/tlds/c.tld</taglib-location> 

        </taglib> 

        <taglib> 

            <taglib-uri>http://java.sun.com/jstl/core-rt</taglib-uri> 

            <taglib-location>/WEB-INF/tlds/c-rt.tld</taglib-location> 

        </taglib> 

        <taglib> 

            <taglib-uri>http://java.sun.com/jstl/sql</taglib-uri> 

            <taglib-location>/WEB-INF/tlds/sql.tld</taglib-location> 

        </taglib> 

        <taglib> 

             <taglib-uri>http://java.sun.com/jstl/sql-rt</taglib-uri> 

                 <taglib-location>/WEB-INF/tlds/sql-rt.tld</taglib-location> 

        </taglib> 

        <taglib> 

            <taglib-uri>http://java.sun.com/jstl/x</taglib-uri> 

            <taglib-location>/WEB-INF/tlds/x.tld</taglib-location> 

        </taglib> 

        <taglib> 

            <taglib-uri>http://java.sun.com/jstl/x-rt</taglib-uri> 

            <taglib-location>/WEB-INF/tlds/x-rt.tld</taglib-location> 

        </taglib> 

    </jsp-config> 

</web-app> 

JSP檔案中導入<%@ taglib prefix="c" uri="/WEB-INF/lib/c.tld" %>

轉載于:https://www.cnblogs.com/yan5lang/archive/2009/07/15/1524161.html