欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

cannot be resolved in either web.xml or the jar files deployed with this application

程序员文章站 2024-03-15 14:19:29
...

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

IDEA maven项目中的module模块中使用jstl标签遇到的问题

问题:代码中没有报错,也在依赖中添加了相关jar包,排查后发现在Project Structure中选中出问题的module后Problems项中出现了几个问题,错误信息是我依赖的jar包丢失(具体什么原因还不知道),然后根据提示点fix消除问题后,重新添加依赖后项目就能正常运行了,下面就是怎么添加依赖项的流程
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

cannot be resolved in either web.xml or the jar files deployed with this application
但是在运行时就会报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.首先在主项目的pom.xml文件中配置jstl和standard

	<!--JSTL-->
    <dependency>
      <groupId>jstl</groupId>
      <artifactId>jstl</artifactId>
      <version>1.2</version>
    </dependency>
    <dependency>
      <groupId>taglibs</groupId>
      <artifactId>standard</artifactId>
      <version>1.1.2</version>
    </dependency>

2.将jar包添加到module中,首先进入Project Structurecannot be resolved in either web.xml or the jar files deployed with this application
然后选择module,选中我们需要配置的module
cannot be resolved in either web.xml or the jar files deployed with this application
然后选择Dependencies项,点击右边的+号,选择Liabrary
cannot be resolved in either web.xml or the jar files deployed with this application
然后选中jstl和standard两项,然后点击Add Selected
cannot be resolved in either web.xml or the jar files deployed with this application
然后先Apply,再OK,完成这一步后就可以了,总感觉不稳妥的也可以把依赖项勾选再应用确定
cannot be resolved in either web.xml or the jar files deployed with this application