views:

24

answers:

1

Hello,

I'm trying to avoid using c:forEach because I heard that JSTL doesn't mix well into the render phase of the JSF... I'm not sure of that claim at all. On the contrary I had to resort to using c:forEach instead of ui:repeat in many cases because the ui:repeate simply does NOT iterate on the collection.. this happened in many cases that I cannot isolate the reason, and in all of these cases c:forEach was a very well behaved replacement. My question is about the one case in which c:forEach is not behaving well, and ui:repeat is not returning anything from the collection (even though it repeats the decorating html tags the correct number of times).

What happens is that sometimes the JSF components created inside the c:forEach get scattered all over the page, leaving the decorating HTML tags in the body of the c:forEach empty and getting rendered else where in the page. This happens only some times and specially when doing a refresh using F5 (which gets fixed most of the times with a subsequent refresh using Ctrl+F5).

I am totally perplexed and would appreciate any ideas about what is happening.. why is ui:repeat (and ice:panelSeries) not getting back the values from the collection?? why is c:forEach scattering is content all over the place (seems like a race condition while building the JSf component tree.. maybe the rendered should wait for c:forEach and it doesn't)?? Why did it happen only in this case??

I am sorry that I am not including any code snippets or screen shots because I don't know what to include.. the problem is too general. But you can be quite confider that my syntax is correct... I already checked that.. and I don't use the status variable (which causes too much trouble in ui:repeat).

A: 

ui:repeate simply does NOT iterate on the collection

The following code works:

<ui:repeat value="#{myCollection}" var="item">  
   <h:outputText value="#{item}" />
</ui:repeat>

Why did it happen only in this case??

without an example of this case it's hard to know..

However, c:forEach vs ui:repeat document may help you to find a reason.

Odelya