Problem with <c:forEach>

I have this problem with <c:forEach>

<c:forEach begin="0" end="#{link.level}">

<h:outputText value="x"/>

</c:forEach>

I get this Exception:

java.lang.NullPointerException

at com.sun.facelets.tag.TagAttribute.getInt(TagAttribute.java:100)

at com.sun.facelets.tag.jstl.core.ForEachHandler.getEnd(ForEachHandler.java:215)

at com.sun.facelets.tag.jstl.core.ForEachHandler.apply(ForEachHandler.java:109)

at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)

at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:295)

at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:165)

at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)

at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:295)

at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:165)

at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)

at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:119)

at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)

.........

However, #{link.level} is not null, I am able to display it using

<h:outputText value="#{link.level}"/>

Is this a <c:forEach> bug?

[1562 byte] By [alexda] at [2007-11-26 15:56:09]
# 1

What server are you using?

What version?

What version of JSTL? JSF?

Careful here - you are mixing up JSTL with JSF.

I am not a JSF expert, but AFAIK, the two don't work together that well.

In particular you can't nest JSF components within a JSTL forEach tag.

Also I don't think JSTL understands the #{ expr } syntax yet. Maybe JSTL1.2 will, but JSTL1.1 is the current standard.

There is work being done on getting a "unified" EL, but it is not mainstream yet.

Cheers,

evnafets

evnafetsa at 2007-7-8 22:16:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Thanks for your post, evnafets. I'm using JSF 1.2 that comes with Glassfish(Sun Application Server 9.0_01 (build b14)). JSTL also comes with Glassfish and is v1.1

JSTL normally understands EL syntax. For example this works:

<c:set var="someVariable" value=#{mybean.someValue}"/>

The only problem I've encountered so far is with <c:forEach>.

alexda at 2007-7-8 22:16:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...