Hi,

After reading up some documentation I managed to construct the following solution which I would like to share with all of you

<s:select name="customerData.sex"
               listValue="%{getText(toString())}" headerKey=""
               headerValue="%{getText('choose')}" list="sexesAsList" />



the struts select tag is very powerful in that it allows the very commonly used
header key header value be set as an attribute of the select tag.

to use an enumeration as the value for the list attribute you simply need an acessor from the action bean
that returns a collection

   public List<Sex> getSexesAsList() {
       return Arrays.asList(Sex.values());
   }


Finally Struts2 allows for powerful expressions as attribute values, so that the i18n of the displayed data is very simply achieved by calling the getText() function expression to insert the messages from the resourcebundle file
that is referenced in struts.xml

   <constant name="struts.custom.i18n.resources"
       value="ApplicationResources" />

male=männlich
female=weiblich
choose=bitte wählen






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

Reply via email to