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

錯誤信息:The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this applicationjava

分幾種狀況:web

1.jstl.jar是1.1版本,須要引入standard.jar。tomcat

2.上述兩個jar包若是都有了,反編譯standard.jar包查看是否c.tld中的<uri>http://java.sun.com/jsp/jstl/core</uri>是否是和你頁面上引用的taglib的uri一致。app

  jstl1.0是http://java.sun.com/jstl/corejsp

  jstl1.1是http://java.sun.com/jsp/jstl/core測試

  二者相差個/jspthis

3.若是jstl是1.2版本,那麼這個jar包中集成了standard,不須要再引入standard.jar。spa

4.可能跟tomcat版本有關係。code

  Tomcat6 實現了 servlet 2.5 和JSP2.1的規範,能夠支持JSTL1.2;xml

  Tomcat5實現了 servlet 2.4 和JSP2.0的規範,只能支持JSTL1.1;

5.若是是使用tomcat7及以上版本出現問題。網上搜索有人說是tomcat7+版本再也不支持jstl標籤庫自動導入,須要本身手動添加。

web.xml配置中須要以下配置,而且將jstl1.2.jar中的c.tld(或若是使用jstl1.1版本,將standard.jar中的c.tld)拷出一份來放到WEB-INF路徑下。

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

本人測試tomcat6的web.xml不用配置也未出現上述的錯誤信息。不過也能加上配置,去掉jsp-conifg標籤便可。

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

但願能夠幫到你們~

相關文章
相關標籤/搜索