You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Sonny Gill <so...@gmail.com> on 2009/02/04 04:00:56 UTC

Re: How to display composite listValue in listValue tag in Struts 2 without using iterator

Didn't you also post this at Javaranch
(http://www.coderanch.com/t/429374/Struts/show-composite-string-listValue-attribute)?

I answered it there, have a look.

Cheers,
S.

On Wed, Feb 4, 2009 at 2:58 AM, Saikat Podder
<sa...@gmail.com> wrote:
>
> Hello Friends,
>
>
> I am new to Struts 2 & I need your little help to clear a confusion.
>
> I want to display a Dropdown menu for Plans/Packages from a list of Plan
> object(List). The plan class has fields like id, name, price etc.
>
> so the code for the dropdown menu would be:
>
>
>
> &lt;s:select list="plans" label="Select Plan" name="plan.id" listKey="id"
> listValue="name" value="customer.plan.id" /&gt;
>
>
>
> But this only shows only the name of the plan(like "basic", "intermediate"
> etc.) in the menu, & I want to show some additional info besides the name
> like "basic : 5$/month", "intermediate : 10$/month" etc.) for that I need to
> use the price field of the Plan class also in the listValue expression.
>
>
> I have tried several expressions like listValue="name : price $/month" or
> listValue="%{name} %{price} $/month" but none of the works.
>
>
> So for now the only thing working for me is the normal html tag within an
> iterator.
>
>
> So is it really not possibly to display composite string as the value of
> listValue attribute of
>  the select  tag? or am I missing something?
>
> Thanks in advance
>
> Saikat
>
> --
> View this message in context: http://www.nabble.com/How-to-display-composite-listValue-in-listValue-tag-in-Struts-2-without-using-iterator-tp21816477p21816477.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>

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


Re: How to display composite listValue in listValue tag in Struts 2 without using iterator

Posted by Saikat Podder <sa...@gmail.com>.
Thank you Sonny,
It worked wonderfully  :) 
But apparently the same expression does not work for all types of
attributes.


Sonny Gill wrote:
> 
> Didn't you also post this at Javaranch
> (http://www.coderanch.com/t/429374/Struts/show-composite-string-listValue-attribute)?
> 
> I answered it there, have a look.
> 
> Cheers,
> S.
> 
> On Wed, Feb 4, 2009 at 2:58 AM, Saikat Podder
> <sa...@gmail.com> wrote:
>>
>> Hello Friends,
>>
>>
>> I am new to Struts 2 & I need your little help to clear a confusion.
>>
>> I want to display a Dropdown menu for Plans/Packages from a list of Plan
>> object(List). The plan class has fields like id, name, price etc.
>>
>> so the code for the dropdown menu would be:
>>
>>
>>
>> &lt;s:select list="plans" label="Select Plan" name="plan.id" listKey="id"
>> listValue="name" value="customer.plan.id" /&gt;
>>
>>
>>
>> But this only shows only the name of the plan(like "basic",
>> "intermediate"
>> etc.) in the menu, & I want to show some additional info besides the name
>> like "basic : 5$/month", "intermediate : 10$/month" etc.) for that I need
>> to
>> use the price field of the Plan class also in the listValue expression.
>>
>>
>> I have tried several expressions like listValue="name : price $/month" or
>> listValue="%{name} %{price} $/month" but none of the works.
>>
>>
>> So for now the only thing working for me is the normal html tag within an
>> iterator.
>>
>>
>> So is it really not possibly to display composite string as the value of
>> listValue attribute of
>>  the select  tag? or am I missing something?
>>
>> Thanks in advance
>>
>> Saikat
>>
>> --
>> View this message in context:
>> http://www.nabble.com/How-to-display-composite-listValue-in-listValue-tag-in-Struts-2-without-using-iterator-tp21816477p21816477.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-show-composite-string-for-listValue-attribute-in-select-tag-in-Struts2-without-using-iterator-tp21816477p21825455.html
Sent from the Struts - User mailing list archive at Nabble.com.


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