Skip to main content

JSF 2.0: Legal Types for "value" of h:dataTable

2 replies [Last post]
martyhall
Offline
Joined: 2009-08-19
Points: 0

As far as I can find, neither the published JSF spec (JSF_20090506.pdf) nor the PDL docs for h:dataTable (https://javaserverfaces.dev.java.net/nonav/docs/2.0/pdldocs/facelets/h/d...) say what the legal types are for the "value" attribute of h:dataTable.

I have in my notes that in JSF 1.x, the legal types were array, List, ResultSet, Result, and DataModel. But I can't remember where I came up with this information. And, the PDL docs for ui:repeat (https://javaserverfaces.dev.java.net/nonav/docs/2.0/pdldocs/facelets/ui/...) say that its legal "value" types are array, List, ResultSet, and individual Java object. This is different than what I have for h:dataTable in JSF 1.x, and I would have thought that h:dataTable and ui:repeat would support the same types.

What is the definitive answer, and where in the spec does it say so?

Cheers-

- Marty
-----
JSF 2.0 Training Course: http://courses.coreservlets.com/public-courses/jsf2/

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Ryan Lubke

On 2/24/10 4:15 PM, webtier@javadesktop.org wrote:
> As far as I can find, neither the published JSF spec (JSF_20090506.pdf) nor the PDL docs for h:dataTable (https://javaserverfaces.dev.java.net/nonav/docs/2.0/pdldocs/facelets/h/d...) say what the legal types are for the "value" attribute of h:dataTable.
>
> I have in my notes that in JSF 1.[i]x[/i], the legal types were array, List, ResultSet, Result, and DataModel. But I can't remember where I came up with this information. And, the PDL docs for ui:repeat (https://javaserverfaces.dev.java.net/nonav/docs/2.0/pdldocs/facelets/ui/...) say that its legal "value" types are array, List, ResultSet, and individual Java object. This is different than what I have for h:dataTable in JSF 1.[i]x[/i], and I would have thought that h:dataTable and ui:repeat would support the same types.
>
> What is the definitive answer, and where in the spec does it say so?
>
From the javadocs of UIData.getValue():

Return the value of the UIData. This value must either be be of type
|DataModel|
,
or a type that can be adapted into a |DataModel|
.
|UIData| will automatically adapt the following types:

* Arrays
* |java.util.List|
* |java.sql.ResultSet|
* |javax.servlet.jsp.jstl.sql.Result|

All other types will be adapted using the |ScalarDataModel|

class, which will treat the object as a single row of data.

> Cheers-
>
> - Marty
> -----
> JSF 2.0 Training Course: http://courses.coreservlets.com/public-courses/jsf2/
> [Message sent by forum member 'martyhall' (hall@coreservlets.com)]
>
> http://forums.java.net/jive/thread.jspa?messageID=388535
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: webtier-help@glassfish.dev.java.net
>
>

[att1.html]

martyhall
Offline
Joined: 2009-08-19
Points: 0

Woohoo. This is one reason why I love this forum: fast, knowledgeable replies from the experts. Thanks, Ryan; much appreciated.

Cheers-
- Marty

--------------------------------
JSF 2.0 Training Course: http://courses.coreservlets.com/public-courses/jsf2/