s:radio and s:checkboxlist - how to customize listValue property.

2009-03-11 Thread boraldo

When I use that 2 components in my form I need to set attributes listValue
and listKey.
That attributes as I understand require a field of a bean that is a member
of collection represented by list attribute.

Example:



That means: 
1) there will be one radiobutton for each element of collection getTypes().
2) Each html radiobutton will have value = getId()  and label = getName() .

I want to compose label from several fields of my bean. So I can't write



because that class doesn't have getSomeField() method.

How can I do this ?
-- 
View this message in context: 
http://www.nabble.com/s%3Aradio-and-s%3Acheckboxlist---how-to-customize-listValue-property.-tp22455829p22455829.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: s:radio and s:checkboxlist - how to customize listValue property.

2009-03-11 Thread Jim Kiley
The easiest (I'm not going to say "best") solution is to make a "fake"
getter on your bean.  Make a "getListLabel()" method that composes a String
from the values that you want to display in the list label, and then set the
listValue to be "listLabel".  This is the way I've done this in the past and
it works OK.  It isn't ideal if you want to keep your model carefully
isolated from your UI but my own designs are a little less pure than that.
jk

On Wed, Mar 11, 2009 at 10:05 AM, boraldo  wrote:

>
> When I use that 2 components in my form I need to set attributes listValue
> and listKey.
> That attributes as I understand require a field of a bean that is a member
> of collection represented by list attribute.
>
> Example:
>
> listKey="id" />
>
> That means:
> 1) there will be one radiobutton for each element of collection getTypes().
> 2) Each html radiobutton will have value = getId()  and label = getName() .
>
> I want to compose label from several fields of my bean. So I can't write
>
>
>
> because that class doesn't have getSomeField() method.
>
> How can I do this ?
> --
> View this message in context:
> http://www.nabble.com/s%3Aradio-and-s%3Acheckboxlist---how-to-customize-listValue-property.-tp22455829p22455829.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


-- 
Jim Kiley
Senior Technical Consultant | Summa
[p] 412.258.3346
http://www.summa-tech.com


Re: s:radio and s:checkboxlist - how to customize listValue property.

2009-03-11 Thread boraldo

>> It isn't ideal if you want to keep your model carefully isolated from your
UI 
Unfortunately it is the case, so I need another solution.


Jim Kiley wrote:
> 
> The easiest (I'm not going to say "best") solution is to make a "fake"
> getter on your bean.  Make a "getListLabel()" method that composes a
> String
> from the values that you want to display in the list label, and then set
> the
> listValue to be "listLabel".  This is the way I've done this in the past
> and
> it works OK.  It isn't ideal if you want to keep your model carefully
> isolated from your UI but my own designs are a little less pure than that.
> jk
> 
> On Wed, Mar 11, 2009 at 10:05 AM, boraldo  wrote:
> 
>>
>> When I use that 2 components in my form I need to set attributes
>> listValue
>> and listKey.
>> That attributes as I understand require a field of a bean that is a
>> member
>> of collection represented by list attribute.
>>
>> Example:
>>
>>> listKey="id" />
>>
>> That means:
>> 1) there will be one radiobutton for each element of collection
>> getTypes().
>> 2) Each html radiobutton will have value = getId()  and label = getName()
>> .
>>
>> I want to compose label from several fields of my bean. So I can't write
>>
>>
>>
>> because that class doesn't have getSomeField() method.
>>
>> How can I do this ?
>> --
>> View this message in context:
>> http://www.nabble.com/s%3Aradio-and-s%3Acheckboxlist---how-to-customize-listValue-property.-tp22455829p22455829.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
> 
> 
> -- 
> Jim Kiley
> Senior Technical Consultant | Summa
> [p] 412.258.3346
> http://www.summa-tech.com
> 
> 

-- 
View this message in context: 
http://www.nabble.com/s%3Aradio-and-s%3Acheckboxlist---how-to-customize-listValue-property.-tp22455829p22458070.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org