You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by d4kris <kr...@gmail.com> on 2007/02/06 16:11:23 UTC

s2 Select listValue with message bundle key

Hi, 

Im trying to populate a select list with the select tag and would like the
listValue to lookup a message in a resource bundle. Does anybody know if
this is possible or do I have to populate my list with the proper values
before sending it to my jsp?

Example:
I have a property languageList, which is a list of language codes like 'en',
'fr' etc.
The select list I want to generate should have the iso2Code as key and the
message from a resource bundle with the key iso2Code.

So something along these lines:

<s:select name="languageCode" 
	list="languageList" 
	listKey="iso2Code" 
	listValue="%{getText(iso2Code)}"  />

Any ideas?
Thanks
/K
-- 
View this message in context: http://www.nabble.com/s2-Select-listValue-with-message-bundle-key-tf3181085.html#a8827596
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


S2: static-parameters

Posted by "Hartrich, James CTR USTRANSCOM J6" <Ja...@ustranscom.mil>.
Null beans are not being instantiated in the action on request.  Where
are static parameters such as CREATE_NULL_OBJECT set on the action?



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


Re: s2 Select listValue with message bundle key

Posted by Tom Schneider <sc...@gmail.com>.
<s:select name="languageCode"
        list="languageList"
        listKey="iso2Code"
        listValue="%{getText(iso2Code)}"  />

This code will iterate over the languageList and look for a iso2Code
property on each bean within the languageCode.  Based on your description, I
don't think that's the intent.  Try something like this:

<s:select name="languageCode"
        list="languageList"
        listKey="top"
        listValue="%{getText(top)}"  />

'top' should grab the top element of the OGNLValueStack, since what you
really want is the strings that you are interating over.



On 2/6/07, d4kris <kr...@gmail.com> wrote:
>
>
> Hi,
>
> Im trying to populate a select list with the select tag and would like the
> listValue to lookup a message in a resource bundle. Does anybody know if
> this is possible or do I have to populate my list with the proper values
> before sending it to my jsp?
>
> Example:
> I have a property languageList, which is a list of language codes like
> 'en',
> 'fr' etc.
> The select list I want to generate should have the iso2Code as key and the
> message from a resource bundle with the key iso2Code.
>
> So something along these lines:
>
> <s:select name="languageCode"
>         list="languageList"
>         listKey="iso2Code"
>         listValue="%{getText(iso2Code)}"  />
>
> Any ideas?
> Thanks
> /K
> --
> View this message in context:
> http://www.nabble.com/s2-Select-listValue-with-message-bundle-key-tf3181085.html#a8827596
> 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
>
>