This absolute uri http://Java.sun.com/jsp/jstl/core) cannot be resolved in either web.xml or the jar

来源:互联网 发布:mac怎么软件下载 编辑:程序博客网 时间:2024/05/17 18:44

JSTL标签库引入失败


关于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

       

按照上面的改过之后,大体有两种解决方法:

       第一种就是在Eclipse的工程中导入JSTL1.1后,下载JSTL1.1  http://jakarta.apache.org/taglibs/index.html---jstl.jra  standard.jar 两jar包
然后解压,把*.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,把下载的c.tld、x.tld、fmt.tld三个文件放到web-inf下,web文件增加下面的语句:
<jsp-config>
   <taglib>
    <taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
    <taglib-location>/WEB-INF/c.tld</taglib-location>
   </taglib>
   <taglib>
    <taglib-uri>http://java.sun.com/jsp/jstl/xml</taglib-uri>
    <taglib-location>/WEB-INF/x.tld</taglib-location>
   </taglib>
   <taglib>
    <taglib-uri>http://java.sun.com/jsp/jstl/fmt</taglib-uri>
    <taglib-location>/WEB-INF/fmt.tld</taglib-location>
   </taglib>
   <taglib>
    <taglib-uri>http://java.sun.com/jsp/jstl/sql</taglib-uri>
    <taglib-location>/WEB-INF/sql.tld</taglib-location>
   </taglib>
</jsp-config>

       JSP中导入

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

应该就OK了


0 0