webtier@glassfish.java.net

Re: [webtier] How to handle a list in JSF 2

From: Imre Osswald <ioss_at_mx.jevelopers.com>
Date: Sun, 3 Jan 2010 00:51:10 +0100

if it is a list of list you can do the following:

<h:datatable value="#{myBean.myList}" var="item">
     <h:column>
          #{item[0]}
     </h:column>
     <h:column>
          #{item[1]}
     </h:column>
     <h:column>
          #{item[2]}
     </h:column>
</h:datable>

Hope this helps,
Imre

(I wrote that before, but it does not seem to got through)

On 03.01.2010, at 00:44, Celinio Fernandes wrote:

> Thanks.
> Although I have already found a solution, I am open to new ones.
> I am not familiar with the UIData component yet.
> To try to explain things better when i say "results with multiple
> entities", here is an example of a query that looks like the one i use
> and that i want to feed to my h:datatable :
>
> SELECT a.id, c.name, t.address FROM Car a, Owner t, Bank c where
> a.id = t.id and t.id = c.id ;
>
> Here the result is not mapped to a single existing entity (or DAO).
>
> So, would it still work with UIData ? If yes, is there an example
> somewhere ? I suppose i'd have to create a DTO anyway.
> Thanks.
>
>
> --- On Sun, 1/3/10, Jason Lee <jasondlee_at_sun.com> wrote:
>
> From: Jason Lee <jasondlee_at_sun.com>
> Subject: Re: [webtier] How to handle a list in JSF 2
> To: webtier_at_glassfish.dev.java.net
> Date: Sunday, January 3, 2010, 4:56 AM
>
> UIData is designed to handle multiple entry data sets, including
> Lists. What's the data type in the List? You say this:
>
> ((name1, title1, age1), (name2, title2, age2), ..., (nameN, titleN,
> ageN)
>
> Are those JPA entities? If so, you should be able to use
> #{item.name}, etc.
>
> Unless I'm missing something...
>
> On 1/2/10 3:34 PM, Celinio Fernandes wrote:
>>
>> I posted that issue (enhancement) :
>> Issue 713 posted
>> Email sent to: issues_at_javaserverfaces-spec-public,
>> javaserverfowner, longbeach, lidia
>>
>> Not sure i posted it right, this is the first time i do it.
>>
>> --- On Sun, 1/3/10, Lincoln Baxter, III <lincolnbaxter_at_gmail.com>
>> wrote:
>>
>> From: Lincoln Baxter, III <lincolnbaxter_at_gmail.com>
>> Subject: Re: [webtier] How to handle a list in JSF 2
>> To: webtier_at_glassfish.dev.java.net
>> Date: Sunday, January 3, 2010, 2:34 AM
>>
>> By the way, i know i should check the documentation first, which i
>> will pretty soon, but do you know if the Ajax features that have
>> been integrated in JSF 2.0 bring anything new to the datatable
>> component ?
>>
>> They do not, but of course, can now be ajaxified ;)
>>
>> If you think this is something JSF should be doing for you,
>> consider filing an enhancement request here:
>>
>> https://javaserverfaces-spec-public.dev.java.net/servlets/ProjectIssues
>>
>> or you can post a thread here:
>>
>> http://wiki.jcp.org/boards/index.php?b=jsr-314-public (you need a
>> JCP.org account)
>>
>> these links are all available here:
>>
>> http://www.javaserverfaces.org/home
>>
>> --Lincoln
>>
>
>
> --
> Jason Lee
> Senior Java Developer
> GlassFish Administration Console
>
> Sun Microsystems, Inc.
> Phone x31197/+1 405-343-1964
> Email jasondlee_at_sun.com
> Blog http://blogs.sun.com/jasondlee
> Blog http://blogs.steeplesoft.com
>