You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Toni Lyytikäinen <to...@gmail.com> on 2007/08/08 13:11:21 UTC

Localizing the list in a -tag?

Hello,

Is it possible to localize the options in the list attribute of the
<s:select>-tag? I've tried several approaches but none of them seem to work.
What I'm aiming at is something like the following:

<s:select name="somename"
    list="#{
        '01' : 'this should be some localized text from a bundle',
        '02' : 'this text should be localized too',
        }"
    value="x"
/>

For some reason it seems to be impossible to use double quotes (") for the
elements in the map, unless escaped, and the escaping means that the
expression inside won't be evaluated.

Re: Localizing the list in a -tag?

Posted by Eddie Lau <ed...@octopus.com.hk>.
   list="#{'01': getText('message.key'), ...


Hi,


I have tried the above and it doesn't work:
"the requested key list="#xxxxxx" cannot be resolved as a collection/...."

so i do the bundle mapping in my Action class before the map is populated.
just FYI.


Eddie Lau

-- 
View this message in context: http://www.nabble.com/Localizing-the-list-in-a-%3Cs%3Aselect%3E-tag--tp12051158p17878965.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: Localizing the list in a -tag?

Posted by Laurie Harper <la...@holoweb.net>.
Toni Lyytikäinen wrote:
> Hello,
> 
> Is it possible to localize the options in the list attribute of the
> <s:select>-tag? I've tried several approaches but none of them seem to work.
> What I'm aiming at is something like the following:
> 
> <s:select name="somename"
>     list="#{
>         '01' : 'this should be some localized text from a bundle',
>         '02' : 'this text should be localized too',
>         }"
>     value="x"
> />
> 
> For some reason it seems to be impossible to use double quotes (") for the
> elements in the map, unless escaped, and the escaping means that the
> expression inside won't be evaluated.
> 

Have you tried something like (untested):

   list="#{'01': getText('message.key'), ...

L.


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