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