This question already has answers here: Can not find the tag library descriptor for “http://java.sun.com/jsp/jstl/core” (17 answers) Closed 7 years ago.
I am using a JSP page to print an array of values. I'm trying to use JSTL <c:forEach>
for this.
<c:forEach items="${objects}" var="object">
<td>${object.name} </td>
</c:forEach>
The problem is my JSTL taglib declaration:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
The IDE shows an error on this line
Can not find the tag library descriptor.
Many of the forums point to the old Sun site to download the JSTL libraries. Now all of these links point to the Oracle home page with no link to JSTL binaries. This is leading me to believe there is a newer approach to accomplish this.
jstl.jar
in the classpath? Check the link may be it will help stackoverflow.com/questions/5987908/…
To resolve this issue:
The jstl jar should be in your classpath. If you are using maven, add a dependency to jstl in your pom.xml using the snippet provided here. If you are not using maven, download the jstl jar from here and deploy it into your WEB-INF/lib. Make sure you have the following taglib directive at the top of your jsp: <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
Just check our own JSTL wiki page for the proper download links and crystal clear installation instructions.
Put your mouse above the [jstl]
tag which you put on the question yourself until a black box shows up and click therein the info link.
Then scroll a bit down to JSTL versions information until you find download link to JSTL 1.2 (or 1.2.1).
Finally just drop exactly that file in webapp's /WEB-INF/lib
.
This way the taglib declaration must not give any errors anymore and the JSTL tags and functions should just work.
jstl-1.2.jar
and not necessarily jstl-api-1.2.jar
I just want to share my experience. I have same problem about jstl using maven. I resolved it by adding two dependency.
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
If you use Tomcat server I suggest you to put JSTL .jar file to the Tomcat lib folder. By doing this you will have an access to JSTL in all your web projects automatically (with taglib declaration in .jsp files of course).
This is a fix for people who are not using maven. You also need to add standard.jar
to your lib folder for the core tag library to work. Works for jstl version 1.1.
<%@taglib prefix="core" uri="http://java.sun.com/jsp/jstl/core"%>
I was getting this problem with a maven project using the eclipse IDE. I changed the 'Order and Export' in the project's build path putting the Maven dependencies first and the error disappeared. I guess it's because the eclipse IDE was initially building my application source before loading the Maven libraries.
https://i.stack.imgur.com/UJAKF.png
Success story sharing