I am having a problem in migrating a pure html/jsp table to JSF, I don't know if I am still not used to think in JSF terms but I kind of get the impression that table components in JSF miss lots of features that were present in html/JSP.
I iterated over an Array and formed rows in a table as many as the elements in the Array, but now in JSF, there is no equivalent. The thing is h:dataTable works well with a list using some get method but where as if i have a normal Array,where i can loop over using a counter, what should be the equivalent?
Pls give me an example of building a table with an Array of Strings.
Thanks a lot, hari
John Bartlett
Ranch Hand
Joined: Jan 25, 2006
Posts: 116
posted
Hi,
If you mean how do I use a List<Object[]> you just do this:
where objectArrays returns a List<Object[]>
John [ July 25, 2007: Message edited by: John Bartlett ]
Tim Holloway
Bartender
Joined: Jun 25, 2001
Posts: 8829
posted
A major difference between, say, using JSTL and building up a table using iteration tags and JSF is that JSF discourages logic-type operations from being part of the display object. You don't/can't iterate through a JSF datatable. A datatable is a complete object that automatically formats and displays tabular data without the need for iterative logic.
The datatable is bound to a model object, which is a collection of rows and columns. If you want to alter the data displayed in the datatable, you have to alter it in the model - the datatable will faithfully render whatever it finds in the model - each and every row and column.
Search back about 2 months in this forum and you'll find an example I posted where I dynamically built a model based on a row list of column lists of Strings.
We glorify the term "computer hacker", but hacking is something you do crudely with an axe or a machete. Why don't we value "Software Surgeons"?
subject: Help in table conversion from HTML to JSF