Re: i18n for Enum values in s:select

2007-08-28 Thread David Artiga

Try this:

 s:select
   name=frmColour
   label=colour
   list=colourList
   listValue=%{getText('myColor.'+toString())}
 /

and in you resources file:

myColor.WHITE=Blanc
myColor.RED=Rouge
myColor.BLACK=Noir


sarat.pediredla wrote:
 
 I have a s:select form element in my JSP that gets a list of enums to
 display in a drop down box.
 
 The following is my enum
 
 public enum Colour {
WHITE,
RED,
BLACK;
 }
 
 The following is the action method that returns a List for my s:select
 
   public List getColourList() {
 return  Arrays.asList(Colour.values());
 }
 
 The following is my JSP
 
  s:select
name=frmColour
label=colour
list=colourList
  /
 
 This works fine and the drop down list has the values from the enum.
 
 However, I want to be able to use localised string values for each enum
 value (ex. blanc for WHITE viz. french).
 
 I cant figure out how to get Struts 2 to grab these from the
 ApplicationResources.properties file. 
 
 Can I even localise the content from enums in s:select at the JSP
 (presentation) layer?
 

-- 
View this message in context: 
http://www.nabble.com/i18n-for-Enum-values-in-s%3Aselect-tf3959226.html#a12364787
Sent from the Struts - User mailing list archive at Nabble.com.


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



i18n for Enum values in s:select

2007-06-21 Thread sarat.pediredla

I have a s:select form element in my JSP that gets a list of enums to display
in a drop down box.

The following is my enum

public enum Colour {
   WHITE,
   RED,
   BLACK;
}

The following is the action method that returns a List for my s:select

  public List getColourList() {
return  Arrays.asList(Colour.values());
}

The following is my JSP

 s:select
   name=frmColour
   label=colour
   list=colourList
 /

This works fine and the drop down list has the values from the enum.

However, I want to be able to use localised string values for each enum
value (ex. blanc for WHITE viz. french).

I cant figure out how to get Struts 2 to grab these from the
ApplicationResources.properties file. 

Can I even localise the content from enums in s:select at the JSP
(presentation) layer?
-- 
View this message in context: 
http://www.nabble.com/i18n-for-Enum-values-in-s%3Aselect-tf3959226.html#a11234716
Sent from the Struts - User mailing list archive at Nabble.com.


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