Can not find the tag library descriptor of springframework
Asked Answered
B

14

31

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

Belay answered 18/11, 2010 at 20:19 Comment(1)
Can you please tell me the link to download Spring Dependency Jar?Inexhaustible
W
15
  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" %>
    
What answered 19/11, 2010 at 6:49 Comment(4)
Thanks for your answer. Just had found the same solution to the problem and was going to offer it here when I saw your responseBelay
Extracting the TLD from the JAR is not necessary.Imp
It's strange. When I opened the project in Eclipse, the project showed this error. When I modified the web.xml the error disappeared. But given the comments of Steven Benitez, I took back the change ... and now shows no errors! Why? I dont'know...Belay
I added a space in the web.xml file, saved and the error was removed for me to. I only have the spring-webmvc.jar in WEB-INF/lib (no tablib declaration)Muniz
A
17

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.

Avowed answered 8/12, 2011 at 16:51 Comment(0)
W
15
  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" %>
    
What answered 19/11, 2010 at 6:49 Comment(4)
Thanks for your answer. Just had found the same solution to the problem and was going to offer it here when I saw your responseBelay
Extracting the TLD from the JAR is not necessary.Imp
It's strange. When I opened the project in Eclipse, the project showed this error. When I modified the web.xml the error disappeared. But given the comments of Steven Benitez, I took back the change ... and now shows no errors! Why? I dont'know...Belay
I added a space in the web.xml file, saved and the error was removed for me to. I only have the spring-webmvc.jar in WEB-INF/lib (no tablib declaration)Muniz
S
13

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

Sudatory answered 18/11, 2011 at 12:4 Comment(3)
my guess is that removing the space did nothing at all. other than ensured that eclipse picked up "a change" on the file and re-validated. i think if you added/removed a space elsewhere it might have worked the sameNavigate
Removing/adding space worked only after I added required dependencies for taglib. Removing or adding space did nothing other than re-validating.Bacteriophage
Worked for me as well, but my problem was the %> at the end had no space after the closing double-quote.Heng
L
12

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>
Lizbeth answered 18/12, 2013 at 20:6 Comment(0)
I
3

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.

Imp answered 18/11, 2010 at 21:9 Comment(0)
I
3

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>
Invitatory answered 7/8, 2012 at 21:6 Comment(0)
L
2

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

Later answered 11/3, 2014 at 12:1 Comment(0)
G
1

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.

Gannon answered 7/7, 2012 at 11:0 Comment(0)
C
1

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

Cart answered 23/4, 2015 at 12:44 Comment(0)
P
0

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.

Pru answered 24/10, 2012 at 16:53 Comment(0)
B
0

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.

Broadbent answered 12/1, 2017 at 12:31 Comment(0)
D
0

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>
Diedra answered 9/6, 2017 at 13:4 Comment(0)
R
0

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>
Roundtree answered 22/1, 2019 at 23:33 Comment(0)
G
0

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

Garcon answered 12/6, 2020 at 7:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.