Win a copy of Python Continuous Integration and Delivery this week in the Python 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

Confuse - a DataTable Attribute  RSS feed

 
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am confused about the "value" attribute of the h:dataTable. Take a look at the example below:



The "var" attribute of the <h:dataTable ..> is used to denote a Java Bean that has a number of attributes. For example: "#{mailBean.from}", "#{mailBean.to}", etc.

What does the "value" attribute in the <h:dataTable ..> do? Why do we need a mailForm? And the mailForm has a "mails" attribute?
 
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
- "value" represents the collection object representing the dataTable rows.
- "var" attribute represents the selected row in the datatable
 
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am also interested in this topic. Therefore,

the "mailsForm" represents a collection of rows. and the "mailBean" represents each row in that collection.

Then, what is "mails" in "#{mailsForm.mails}"?
 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

...java.util.Lists, arrays, java.sql.ResultSets, and javax.servlet.jsp.jstl.sql.Results...

from ...

'mails' can be either an object of type 'javax.faces.model.DataModel', the easiest of which would probably be 'javax.faces.model.ListDataModel', or 'mails' can be a 'java.util.List', and array, a ResultSet, or the funky Result object in jstl (<-- correct?)

I generally use DataModel because then you just call 'getRowData' to get the selected object and you're on your way.
 
Kevin Galligan
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow, that was confusing. I started quoting another forum, but then just decided to explain it. That should have been...


'mails' can be either an object of type 'javax.faces.model.DataModel', the easiest of which would probably be 'javax.faces.model.ListDataModel', or 'mails' can be a 'java.util.List', and array, a ResultSet, or the funky Result object in jstl (<-- correct?)

I generally use DataModel because then you just call 'getRowData' to get the selected object and you're on your way.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!