Localized key values in s:select

View: New views
3 Messages — Rating Filter:   Alert me  

Localized key values in s:select

by Ignacio de Córdoba :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,
I wonder if it is possible to make s:select tag localize the content of option elements. I am using:

<s:select labelposition="left" key="category" id="category" list="%{categories}"  listKey="id" listValue="name" emptyOption="true"/>

I'd like attribute listValue="name" property value if the objects iterated not to be shown "as is" but to be used as a key to the language property files... just like the "key" attribute value ("category" in this example) is localized.

¿Is it possible or I must pre-populate the list with already localized strings?

Thanks,
Ignacio

Re: Localized key values in s:select

by Paweł Wielgus :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Ignacio,
it's possible, just use listValue="getText(name)",
it should work just like that, just add to your properties file a key
that match name value,
so that getText will have something to show.

Best greetings,
Paweł Wielgus.


El día 12 de noviembre de 2009 19:26, Ignacio de Córdoba
<icordoba@...> escribió:

>
> Hello,
> I wonder if it is possible to make s:select tag localize the content of
> option elements. I am using:
>
> <s:select labelposition="left" key="category" id="category"
> list="%{categories}"  listKey="id" listValue="name" emptyOption="true"/>
>
> I'd like attribute listValue="name" property value if the objects iterated
> not to be shown "as is" but to be used as a key to the language property
> files... just like the "key" attribute value ("category" in this example) is
> localized.
>
> ¿Is it possible or I must pre-populate the list with already localized
> strings?
>
> Thanks,
> Ignacio
> --
> View this message in context: http://old.nabble.com/Localized-key-values-in-s%3Aselect-tp26323814p26323814.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@...
> For additional commands, e-mail: user-help@...
>
>

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


Re: Localized key values in s:select

by Brian Thompson-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Try this:

<s:select labelposition="left" key="category" id="category"
list="%{categories}"  listKey="id" listValue="%{getText(name)}"
emptyOption="true"/>



2009/11/12 Ignacio de Córdoba <icordoba@...>

>
> Hello,
> I wonder if it is possible to make s:select tag localize the content of
> option elements. I am using:
>
> <s:select labelposition="left" key="category" id="category"
> list="%{categories}"  listKey="id" listValue="name" emptyOption="true"/>
>
> I'd like attribute listValue="name" property value if the objects iterated
> not to be shown "as is" but to be used as a key to the language property
> files... just like the "key" attribute value ("category" in this example)
> is
> localized.
>
> ¿Is it possible or I must pre-populate the list with already localized
> strings?
>
> Thanks,
> Ignacio
> --
> View this message in context:
> http://old.nabble.com/Localized-key-values-in-s%3Aselect-tp26323814p26323814.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@...
> For additional commands, e-mail: user-help@...
>
>