• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown

Iterating component that acts like panelGrid

Posts: 1845
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a list of items I want to iterate over, and display in a panel grid format - ie specify a number of columns, and then the component just adds table cells, wrapping around to the next row when it reaches the column count - just as the PanelGrid does.
ie specifying 3 columns, with 5 items in the list would give something like this:

| item1 | item2 | item3 |
| item4 | item5 | |

The only method of iterating over a list in JSF seems to be the DataTable component. However it assumes a one record per row format. It won't do the format I want.
PanelGrid which DOES do that format doesn't seem to provide any way of iterating over a list/datasource.

I can get the layout I want with a simple JSTL <c:forEach> tag (or any other non-faces iteration), and manually generating table tags, but then I can't use any faces tags within it. (urls/buttons etc)

I know JSP/JSTL/Struts well enough, and have got my head around the basics of JSF, but this seemingly simple requirement doesn't have an obvious solution to me.
Is there a way of doing this with JSF?

    Bookmark Topic Watch Topic
  • New Topic