• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help in table conversion from HTML to JSF

 
pulijala hari
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18408
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!