webtier@glassfish.java.net

Re: [webtier] JSF 2.0: Legal Types for "value" of h:dataTable

From: Ryan Lubke <Ryan.Lubke_at_Sun.COM>
Date: Wed, 24 Feb 2010 17:05:12 -0800

On 2/24/10 4:15 PM, webtier_at_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/dataTable.html) 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/repeat.html) 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|
<http://java.sun.com/javaee/javaserverfaces/2.0/docs/api/javax/faces/model/DataModel.html>,
or a type that can be adapted into a |DataModel|
<http://java.sun.com/javaee/javaserverfaces/2.0/docs/api/javax/faces/model/DataModel.html>.
|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|
<http://java.sun.com/javaee/javaserverfaces/2.0/docs/api/javax/faces/model/ScalarDataModel.html>
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_at_coreservlets.com)]
>
> http://forums.java.net/jive/thread.jspa?messageID=388535
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net
>
>