开发者

Can not find the tag library descriptor of springframework

I'm trying to follow the example of spring JPetStore but I get an error in the JSP pages in the line that references the lib tag spring:

Can not find the tag library descriptor for "http://www.springframework.org/tags"

<开发者_开发技巧;%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>

What is the URL of this library?

Is there any way to avoid the direct dependence on this URL?

Thanks in advance


I know it's an old question, but the tag library http://www.springframework.org/tags is provided by spring-webmvc package. With Maven it can be added to the project with the following lines to be added in the 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>

Without Maven, just add that jar to your classpath. In any case it's not necessary to refer the tld file directly, it will be automatically found.


  1. Download the Spring dependency jar
  2. Place it to the lib folder path is /WEB-INF/lib/spring.jar
  3. Then open the web.xml and the sample code is:

    <taglib>
      <taglib-uri>/WEB-INF/spring.tld</taglib-uri>
      <taglib-location>/WEB-INF/spring.tld</taglib-location>
    </taglib>
    
  4. Then the taglib is indicated where the jar file locates in ur system.

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


Removing the space between @ and taglib did the trick for me: <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>


If you are using maven use this dependency:

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


The TLD should be located in the spring.jar. Your application won't have any dependency on that URL. It's just used as a unique name to identify the tag library. They could just as well have made the URI "/spring-tags", but using URLs is pretty common place.


you have to add the dependency for springs mvc

tray adding that in your pom

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


I had the same issue with weblogic 12c and maven I initially while deploying from eclipse (kepler) (deploying from the console gave no errors).

The other solutions given on this page didn't help.

I extracted the spring.tld spring-form.tld files of the spring-webmvc jar (which I found in my repository) in the web\WEB-INF folder of my war module;

I did a fresh build; deployed (from eclipse) into weblogic 12c, tested the application and the error was gone;

I removed the spring.tld spring-form.tld files again and after deleting; rebuilding and redeploying the application the error didn't show up again.

I double checked whether the files were gone in the war and they were indeed not present.

hope this helps others with a similar issue...


I finally configured RAD to build my Maven-based project, but was getting the following exception when I navigate to a page that uses the Spring taglib:

JSPG0047E: Unable to locate tag library for uri http://www.springframework.org/tags at com.ibm.ws.jsp.translator.visitor.tagfiledep.TagFileDependencyVisitor.visitCustomTagStart(TagFileDependencyVisitor.java:76) ...

The way I had configured my EAR, all the jars were in the EAR, not in the WAR’s WEB-INF/lib. According to the JSP 2.0 spec, I believe tag libs are searched for in all subdirectories of WEB-INF, hence the issue. My solution was to copy the tld files and place under WEB-INF/lib or WEB-INF.. Then it worked.


If you want direct link:

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

Or from repos:

JCenter : link

Maven Central : link

And if you need as Gradle dependency:

compile 'org.springframework:spring-webmvc:4.1.6.RELEASE

More information about spring-form: http://docs.spring.io/spring/docs/current/spring-framework-reference/html/spring-form.tld.html


Here is another case.

We have several portlets in different portlet application war and all of them use spring. So in order to reduce size of each war, we have created shared libraries for spring jars in the WebSphere Portal server.

However, I came across the same issue as above of not having the spring form tags being referred from the jsp files.

In order to resolve, I have copied the spring-form.tld file into the WEB-INF/ directory and redeployed the war and it worked.

Hope it helps for anyone having a similar issue as mine.


This problem normally appears while copy pasting the tag lib URL from the internet. Usually the quotes "" in which the URL http://www.springframework.org/tags is embedded might not be correct. Try removing quotes and type them manually. This resolved the issue for me.


I was using Spring-Boot, For me cut-paste of below in Pom.xml worked. May be file wasnt in sync.

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


Core dependencies for tag library:

> <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>


add external jar of jstl-standard.jar as the external jar by right click on JRE system libraries under configure build path -> build path. it worked for me!!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜