So I'm trying to loop over a List<MyClass>
for display in the view of my spring webflow application. However I get the error Must evaluate to a Collection, Map, Array, or null.
<c:forEach items="#{orderedStuff}" var="a">
#{a.PrettyName}test
</c:forEach>
I've also tried $ instead of #.
Here is my xml flow definition.
<view-state id="bookToc">
<on-render>
<evaluate expression="stuffService.getOrderedStuff(stuff)" result="viewScope.orderedStuff"
result-type="dataModel" />
</on-render>
</view-state>
And the function that returns the list of sections.
public List<Stuff> getStuff(Stuff stuff) {
final List<Stuff> orderedStuff= new ArrayList<Stuff>();
final List<Stuff> sections = stuff.getStuff();
PropertyComparator.sort(sections, new MutableSortDefinition("sortOrder", true, true));
for (Section stuff : stuffs) {
orderedStuff.add(stuff);
this.addSubsectionsToOrderedStuff(stuff, orderedStuff);
}
return orderedStuff;
}
The thing about it is, this code DOES WORK
<h:dataTable id="stuffList" value="#{orderedStuff}" var="s"
rendered="#{not empty orderedStuff}">
<h:column>
<f:facet name="header">
Section Title
</f:facet>
#{s.prettyName}
<h:dataTable value="#{s.chapters}" var="c" rendered="#{not empty s.chapters}">
<h:column>
<f:facet name="header">
Chapter Title
</f:facet>
#{c.title}
</h:column>
</h:dataTable>
</h:column>
</h:dataTable>