Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problems using <c:forEach> within JSF datatable, UEL problem?

843844May 6 2008 — edited May 6 2008
Right so my problem here is that <c:forEach> doesn't seem to want to work when I give it its items using # instead of $
So this is what I've got on my jsp page:

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Display Test Form</title>
    </head>
    <body>
        <h2>Display Test Form</h2>
        
        <f:view>
            <h:form>
                <h:dataTable id="steps" value="#{travelerHandler.steps}" var="step" border="1">
                   <f:facet name="header">
                       <h:outputText value="#{travelerHandler.trav.name}" />
                   </f:facet>
                   <h:column>
                       <h:dataTable border="1">
                           <f:facet name="header">
                               <h:outputText value="#{step.step.name}" />
                           </f:facet>
                           <c:forEach items="#{step.tests}" var="test">
                               <h:column>
                                   <f:facet name="header">
                                       <h:outputText value="#{test.test.name}" />
                                   </f:facet>
                                   <h:outputText value="#{test.results.passStatus}" /><br />
                                   <h:outputText value="#{test.results.comment}" />
                               </h:column>
                           </c:forEach>
                       </h:dataTable>
                   </h:column>
                </h:dataTable> 
            </h:form>
        </f:view>
    </body>
</html>
Now as it is right now it throws a JspTagException: Don't know how to iterate over supplied "items" in <c:forEach>.
However if I switch #{step.tests} to ${step.tests) it won't throw any exceptions, however it won't show anything inside the forEach.

I think I might have gotten something wrong in there because its somewhat complex but I have no idea what I did wrong.

The var 'step' within the travelerHandler.steps is a class which holds an ArrayList of another type of class called TestWithResults. This TestWithResults class has, as you can see, the actual test, and the results of the test.

So to reiterate, if I use ${step.tests}, everything on the page will show up except for the content thats supposed to be inside that <c:forEach>.

Any help would be much appreciated, and just tell me if you need any more information.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 3 2008
Added on May 6 2008
3 comments
1,037 views