construct a public Map in your Action class and insert the key,value
pairings e.g.
    public Map getDefaultFavouriteCartoonCharacters() {
        Map m = new LinkedHashMap();
        m.put("heMan", "He-Man");
        m.put("popeye", "Popeye");
        m.put("mockeyMouse", "Mickey Mouse");
        return m;
    }

and reference the public Map via list attribute in your jsp
 <s:select
        list="defaultFavouriteCartoonCharacters"
      ...
  />

or just use a set of hardcoded values in key:value pairings for the list
attribute
 <s:select
        list="#{'heMan':'He-Man', 'popeye':'Popeye', [...]}"
..
/>

Martin
----- Original Message -----
From: "Chris Pratt" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Monday, March 03, 2008 8:02 PM
Subject: Selecting over Static Maps from Resource Bundle


> Is it possible to place the data for the list attribute of an
> <s:select> tag in a resource bundle (so that it can be
> internationalized)?  I have tried adding the data to my
> application.properties file:
>
> gender.map='FEMALE':'Female','MALE':'Male'
>
> Then referencing it in the JSP as:
>
> <s:select name="gender" id="gender" list="#{(getText('gender.map'))}"/>
>
> But this produces, the fairly unusable code:
>
> <select name="gender" id="gender">
>   <option value="FEMALE:Female,MALE:Male"></option>
> </select>
>
> Is there any way to get it to generate:
>
> <select name="gender" id="gender">
>   <option value="FEMALE">Female</option>
>   <option value="MALE">Male</option>
> </select>
>
> Thanks.
>   (*Chris*)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to