![](/img/trans.png)
[英]Can not find the tag library descriptor for “http://java.sun.com/jsp/jstl/core”
[英]JSP error “Can not find the tag library descriptor for ”http://java.sun.com/jsp/jstl/core"
我在行上面收到錯誤
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
作為依賴,我有
<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>
並建立:
<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>
最后是我的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>
我已經閱讀了以下問題,但無法使錯誤消失:
我正在運行Tomcat 9.0.8。 是什么導致此錯誤,我該如何解決?
嘗試以下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>
所以我自己找到了答案。 我根本不需要更改POM或任何其他內容。 我要做的是激活Project Facets
並選擇Tomcat作為運行時。
右鍵單擊項目->屬性->項目構面->檢查:動態Web模塊,Java和JavaScript->單擊右側的Runtimes選項卡並檢查Tomcat服務器
這樣已經解決了一些錯誤。 最后一部分是在項目中部署Maven依賴項。 為此,您將必須轉到:
右鍵單擊項目->屬性->部署程序集->添加...-> Java構建路徑條目->選擇(所有)條目,然后單擊完成
這些是我必須執行的正確運行Web項目的步驟
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.