Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Iterating component that acts like panelGrid  RSS feed

Stefan Evans
Posts: 1836
  • Mark post as helpful
  • send pies
  • 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?

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!