This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

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!