簡體   English   中英

找不到springframework的標簽庫描述符

[英]Can not find the tag library descriptor of springframework

我正在嘗試遵循 spring JPetStore 的示例,但在引用 lib 標記 spring 的行中的 JSP 頁面中出現錯誤:

找不到“http://www.springframework.org/tags”的標簽庫描述符

<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>

這個庫的網址是什么?

有什么辦法可以避免直接依賴這個URL嗎?

提前致謝

我知道這是一個老問題,但是標簽庫http://www.springframework.org/tags是由spring-webmvc包提供的。 使用 Maven 可以將其添加到項目中,並在pom.xml添加以下幾行

<properties>
    <spring.version>3.0.6.RELEASE</spring.version>
</properties>

<dependencies>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${spring.version}</version>
    </dependency>

如果沒有 Maven,只需將該 jar 添加到您的類路徑中。 在任何情況下都不需要直接引用 tld 文件,它會自動找到。

  1. 下載 Spring 依賴 jar
  2. 把它放到lib文件夾路徑是/WEB-INF/lib/spring.jar
  3. 然后打開web.xml,示例代碼為:

     <taglib> <taglib-uri>/WEB-INF/spring.tld</taglib-uri> <taglib-location>/WEB-INF/spring.tld</taglib-location> </taglib>
  4. 然后taglib被指示jar文件在你的系統中的位置。

     <%@ taglib prefix="spring" uri="/WEB-INF/spring.tld" %>

刪除@taglib之間的空格對我來說很有效: <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>

如果您使用 Maven,請使用此依賴項:

<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-taglibs</artifactId>
    <version>3.1.4.RELEASE</version>
</dependency>

您必須為 springs mvc 添加依賴項

托盤在你的 pom 中添加

<!-- mvc -->
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-webmvc</artifactId>
    <version>3.1.2.RELEASE</version>
</dependency>

TLD 應位於spring.jar 您的應用程序不會對該 URL 有任何依賴。 它只是用作標識標簽庫的唯一名稱。 他們也可以將 URI 設為“/spring-tags”,但使用 URL 是很常見的地方。

我最初在從 eclipse (kepler) 部署時遇到了與 weblogic 12c 和 maven 相同的問題(從控制台部署沒有錯誤)。

此頁面上給出的其他解決方案沒有幫助。

我在我的 war 模塊的 web\\WEB-INF 文件夾中提取了 spring-webmvc jar(我在我的存儲庫中找到)的spring.tld spring-form.tld文件;

我做了一個新的構建; 部署(從eclipse)到weblogic 12c,測試應用程序,錯誤消失;

我再次刪除了spring.tld spring-form.tld文件,刪除后; 重建和重新部署應用程序,錯誤沒有再次出現。

我仔細檢查了這些文件是否在戰爭中消失了,它們確實不存在。

希望這可以幫助其他有類似問題的人......

我最終配置了 RAD 來構建我的基於 Maven 的項目,但是當我導航到使用 Spring taglib 的頁面時遇到以下異常:

JSPG0047E: 無法在 com.ibm.ws.jsp.translator.visitor.tagfiledep.TagFileDependencyVisitor.visitCustomTagStart(TagFileDependencyVisitor.java:76) 上找到 uri http://www.springframework.org/tags 的標記庫...

按照我配置 EAR 的方式,所有 jar 都在 EAR 中,而不是在 WAR 的 WEB-INF/lib 中。 根據 JSP 2.0 規范,我相信在 WEB-INF 的所有子目錄中搜索標簽庫,因此存在問題。 我的解決方案是復制 tld 文件並將其放在 WEB-INF/lib 或 WEB-INF 下。然后它起作用了。

如果你想要直接鏈接:

https://github.com/spring-projects/spring-framework/blob/master/spring-webmvc/src/main/resources/META-INF/spring-form.tld

或從回購:

JCenter鏈接

Maven 中心鏈接

如果您需要 Gradle 依賴項:

編譯'org.springframework:spring-webmvc:4.1.6.RELEASE

有關彈簧形式的更多信息: http : //docs.spring.io/spring/docs/current/spring-framework-reference/html/spring-form.tld.html

這是另一個案例。

我們在不同的 portlet 應用程序戰爭中有幾個 portlet,它們都使用 spring。 因此,為了減少每次戰爭的規模,我們在 WebSphere Portal 服務器中為 spring jar 創建了共享庫。

但是,我遇到了與上述相同的問題,即沒有從 jsp 文件中引用 spring 表單標簽。

為了解決,我已經將 spring-form.tld 文件復制到 WEB-INF/ 目錄中,並重新部署了 war 並且它起作用了。

希望它對任何與我有類似問題的人有所幫助。

此問題通常在從 Internet 復制粘貼標簽庫 URL 時出現。 通常,嵌入 URL http://www.springframework.org/tags的引號""可能不正確。 嘗試刪除引號並手動鍵入它們。 這為我解決了這個問題。

我正在使用 Spring-Boot,對我來說在 Pom.xml 中剪切粘貼下面的工作。 可能是文件不同步。

<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
</dependency>

標簽庫的核心依賴:

> <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-taglibs</artifactId>
</dependency>
<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
</dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>

通過在配置構建路徑-> 構建路徑下右鍵單擊 JRE 系統庫,將 jstl-standard.jar 的外部 jar 添加為外部 jar。 它對我有用!!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM