Win a copy of Spring Boot in Practice this week in the Spring forum!
  • 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 ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Help in table conversion from HTML to JSF

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Saloon Keeper
Posts: 25846
184
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic