首页 > 技术文章 > The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application问题解决方案参考

jinzhiming 2019-03-27 16:41 原文

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

分几种情况:

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

2.上述两个jar包如果都有了,反编译standard.jar包查看是否c.tld中的<uri>http://java.sun.com/jsp/jstl/core</uri>是不是和你页面上引用的taglib的uri一致。

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

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

  两者相差个/jsp

3.如果jstl是1.2版本,那么这个jar包中集成了standard,不需要再引入standard.jar。

4.可能跟tomcat版本有关系。

  Tomcat6 实现了 servlet 2.5 和JSP2.1的规范,可以支持JSTL1.2;

  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>

希望可以帮到大家~

推荐阅读