Java--The absolute uri: [http://java.sun.com/jsp/jstl/core] cannot be resolved in either web.xml

2023-10-28

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] with root cause异常处理及解释

1.问题描述:

在web的jsp文件中想用jstl这个标准库,在运行的时候很自然的引用jar包如下:

复制代码

<dependency>
            <groupId>javax.servlet.jsp.jstl</groupId>
            <artifactId>jstl-api</artifactId>
            <version>1.2</version>
        
</dependency>

复制代码

在jsp界面引语句如下:

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

  表面上看没毛病,但是运行的时候,页面直接500了,报错为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] with root cause大致意思为这个绝对路径[http://java.sun.com/jsp/jstl/core]既没有在web.xml配置有没有在jar包文件下部署。

总而言之就是----项目找不到jstl这个库了。

 

2.解决方法:

  经过浏览网上的分析,我的问题是,maven工程发布到tomcat服务器上的过程中,工程并没有将本地已经配置好的jstl1.2的jar包jia部署到tomcat的lib里,所以在工程运行后,点击引用了jstl库的页面显示500并在eclipse中报错。我将本地仓库中jstl.jar复制到tomcat的lib中重新发布一下项目,就恢复正常了。

3.关于问题的情况总结

关于这个问题,我看到的的情况有很多种,大家不妨对照一下:

  <1>jar包引用问题

  1. 项目中没有加载jstl.jar
  2. 加载了版本低于1.0的jstl.jar却没有加载对应的standard.jar包(1.1以上的版本jstl中就包含standard包了)

  <2>jar包引用格式的问题

  1. 项目中加载了1.0以下的jstl.jar在jsp界面引用的格式为:
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>

    2.jstl.1.1版本以及1.2版本都换了一种新的路径:

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

  <3>tomcat没有部署相关的jar包

  将本地仓库中jstl.jar复制到tomcat的lib中重新发布一下项目,就OK了。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Java--The absolute uri: [http://java.sun.com/jsp/jstl/core] cannot be resolved in either web.xml 的相关文章

随机推荐