Sun JSTL taglib declaration fails with "Can not find the tag library descriptor"

SpringJspSpring MvcJstl

Spring Problem Overview


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.

Spring Solutions


Solution 1 - Spring

To resolve this issue:

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

  2. 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"%>
    

Solution 2 - Spring

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.

> enter image description here

Then scroll a bit down to JSTL versions information until you find download link to JSTL 1.2 (or 1.2.1).

> enter image description here

Finally just drop exactly that file in webapp's /WEB-INF/lib.

> enter image description here

This way the taglib declaration must not give any errors anymore and the JSTL tags and functions should just work.

Solution 3 - Spring

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>

Solution 4 - Spring

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

Solution 5 - Spring

You can download the Apache Standard Taglib and include the jar in your project.

Solution 6 - Spring

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

Solution 7 - Spring

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.

Solution 8 - Spring

I was getting the same problem onenter image description here Spring Tool Suite 3.2 and changed the version of jstl to 1.2 (from 1.1.2) manually when adding it to the dependency list, and the error got disappeared.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAtmaView Question on Stackoverflow
Solution 1 - SpringBabu SubburathinamView Answer on Stackoverflow
Solution 2 - SpringBalusCView Answer on Stackoverflow
Solution 3 - SpringTHIHA SOEView Answer on Stackoverflow
Solution 4 - SpringpivopilView Answer on Stackoverflow
Solution 5 - SpringBenoit WickramarachiView Answer on Stackoverflow
Solution 6 - Springuser2339071View Answer on Stackoverflow
Solution 7 - SpringAris CapellosView Answer on Stackoverflow
Solution 8 - SpringdavidqwkView Answer on Stackoverflow