1

My problem is ui:repeat inside a h:panelGrid. Its a big table from a list of objects.. All objects are saved in one list.

I tried this:

<h:panelGrid columns="1000">
  <ui:repeat var="item" value="#{item.list}">
     <h:outputText value="#{item.string}" />
   </ui:repeat>
</h:panelGrid>

but inside a panelGrid the ui:repeat tag is one column for the grid. So all items are in one td tag.

Is there a possibility to get the right column count?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
user962466
  • 11
  • 1
  • 4

1 Answers1

1

In that case you can use c:forEach instead of ui:repeat. c:forEach will cause a separate UIOutputText component in components tree for each item in the list.

For more information on difference between c:forEach and ui:repeat refer here

Roger Keays
  • 3,117
  • 1
  • 31
  • 23
Andrey
  • 6,526
  • 3
  • 39
  • 58
  • 1
    In general, mixing JSTL and JSF is a bad idea. Try to use components designed for this purpose like `rich:dataGrid`, `p:dataGrid` or `p:dataList`. – Thor Apr 19 '12 at 05:16
  • 2
    @Thor in this case JSF and Facelets are mixed. Facelets just provide implementation of a subset of JSTL tags, so purely Facelets handles that using Tag Handlers. Of course it is important to understand the difference between tag handlers and components, but it is OK to mix that. E.g. ui:include, ui:decorate, ui:composition, any custom tag file - are not part of JSTL, but are Tag Handlers, so they have exactly the same nature as c:forEach (refer to link in my answer for more details). – Andrey Apr 24 '12 at 19:11