[英]JSP error “Can not find the tag library descriptor for ”http://java.sun.com/jsp/jstl/core"
I am getting the error above at line 我在行上面收到错误
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
As dependency I have 作为依赖,我有
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
and build: 并建立:
<build>
<finalName>test-jsp</finalName>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webXml>WebContent\WEB-INF\web.xml</webXml>
<warSourceDirectory>WebContent</warSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
And finally my webapp.xml 最后是我的webapp.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
id="WebApp_ID" version="3.1">
<display-name>JSPTest</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>
I already read following question but couldn't get the error to disappear: 我已经阅读了以下问题,但无法使错误消失:
I am running Tomcat 9.0.8. 我正在运行Tomcat 9.0.8。 What could cause this error and how can I fix it?
是什么导致此错误,我该如何解决?
Try with below maven dependancy. 尝试以下Maven依赖性。
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<!-- This can be ignored -->
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jasper</artifactId>
<version>9.0.8</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
So I found the answer myself. 所以我自己找到了答案。 I didn't have to change my POM or anything at all.
我根本不需要更改POM或任何其他内容。 What I had to do was to activate the
Project Facets
and select Tomcat as runtime. 我要做的是激活
Project Facets
并选择Tomcat作为运行时。
Right Click on project -> Properties -> Project Facets -> Check: Dynamic Web Module, Java and JavaScript -> Hit the Runtimes tab on the right and check Tomcat server 右键单击项目->属性->项目构面->检查:动态Web模块,Java和JavaScript->单击右侧的Runtimes选项卡并检查Tomcat服务器
This solved a few errors already. 这样已经解决了一些错误。 The last part was to deploy the maven dependencies with the project.
最后一部分是在项目中部署Maven依赖项。 For this you will have to go to:
为此,您将必须转到:
Right Click on project -> Properties -> Deployment Assembly -> Add... -> Java Build Path Entries -> Select (all) entries and hit Finish 右键单击项目->属性->部署程序集->添加...-> Java构建路径条目->选择(所有)条目,然后单击完成
Those were the steps I had to take to run my web project properly 这些是我必须执行的正确运行Web项目的步骤
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.