|
I seem to have
found a bug in c:forEach when nested in another c:forEach. The inner for loop
does not output correct values for JSTL expression after the second iteration.
The values become empty
Snippet of my
code
<c:forEach
items="${workItems}"
var="workItem"
varStatus="item">
<c:forEach items="${workItem.workItemStatusList}"
var="workItemStatus"
varStatus="status">
<h:outputText id="status#{item.index}#{status.index}#{workItemStatus.id}"
value="Description
${workItemStatus.status.description}" />
</c:forEach>
</c:forEach>
In the above, you
expect the output to be
Description
PENDING
Description
RECORDED
Description
REJECTED
etc
Instead you
get
Description
PENDING
Description
Description
Now if I
change the loop to a nested ui:repeat I get the expected
output.
<ui:repeat value="${workItems}" var="workItem">
<ui:repeat value="${workItem.workItemStatusList}"
var="workItemStatus" >
<h:outputText value="Description
${workItemStatus.status.description}"
/>
</ui:repeat>
</ui:repeat>
The
reason why I am using a c:forEach is that it works nicely with
h:panelGrid. A ui:repeat will mean that I have to use html tables
which would muck up our neat layout code. Another limitation of ui:repeat is
that there is no way to output an index. In this example I don't need it, in
others I may.
Is this
a known problem? Has anyone else come across it?
Mel
|