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

Atma picture Atma · Nov 28, 2012 · Viewed 181.7k times · Source

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.

Answer

Babu Subburathinam picture Babu Subburathinam · Nov 28, 2012

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