Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems with JSTL forEach in JSF 2

Hi I got the following code:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0    
Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:p="http://primefaces.prime.com.tr/ui"
  xmlns:c="http://java.sun.com/jsp/jstl/core"
>

<h:body>
 <c:forEach items="#{backingBean.personList}" var="person">
   <h:outputText value="#{person.name}" />
 </c:forEach>
</h:body>
</html>    

This fails with:

 java.lang.ClassNotFoundException: javax.servlet.jsp.jstl.core.LoopTagStatus

I use jstl-impl-1.2.jar. Does anyone could help me on this one? Thanks

Marcel

like image 522
Marcel Menz Avatar asked Nov 03 '10 11:11

Marcel Menz


3 Answers

I think you are missing a JSTL-api jar.

Classname search on sonatype's nexus returned this maven dependency:

<dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>jstl</artifactId>
  <version>1.1.2</version>
</dependency>

You can download it from this page if you don't use maven.

You can also use Findjar.com to find occurrences of the class.

like image 60
Sean Patrick Floyd Avatar answered Nov 07 '22 07:11

Sean Patrick Floyd


What about standard.jar?

Do you have both JARs in WEB-INF/lib?

like image 22
duffymo Avatar answered Nov 07 '22 07:11

duffymo


If memory serves me right the JSTL core uses EL which has syntax like this ${} rather than #{}.

like image 45
Vincent Ramdhanie Avatar answered Nov 07 '22 09:11

Vincent Ramdhanie