¿Cómo puedo usar i18n en un cuadro combinado usando struts2?

I have a form with a combobox to allow people select if they are a male or female. I want to change Hombre y Mujer for the same words in other language.

My actual combobox is:

<s:combobox readonly="true" key="sex" 
list="{'Male', 'Female'}" value="Male" />

Is there a way to put this combobox in different languages?

preguntado el 03 de mayo de 12 a las 19:05

1 Respuestas

Finally, I found the solution. I have to implement an action that shows this jsp page with a list in its attributes and a getter.

public class Action extends ActionSupport {
    ...
    private List<String> genders = new ArrayList<String> ();

    public Action ()
    {
        genders.add(getText("male"));
        genders.add(getText("female"));
    }

    @Override
    public String input() throws Exception {    
        return NONE;
    }
    ...
}

Then in the jsp page, I use this attribute as the list needed in the combobox.

<s:combobox readonly="true" key="generos" list="genders"/>

contestado el 07 de mayo de 12 a las 08:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.