Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Forms 如何使用struts2在组合框中使用i18n?_Forms_Jsp_Internationalization_Combobox_Struts2 - Fatal编程技术网

Forms 如何使用struts2在组合框中使用i18n?

Forms 如何使用struts2在组合框中使用i18n?,forms,jsp,internationalization,combobox,struts2,Forms,Jsp,Internationalization,Combobox,Struts2,我有一个带有组合框的表单,允许人们选择自己是男性还是女性。我想把男性和女性换成其他语言中相同的词 我的实际组合框是: <s:combobox readonly="true" key="sex" list="{'Male', 'Female'}" value="Male" /> 有没有办法用不同的语言放置这个组合框 最后,我找到了解决办法。我必须实现一个操作来显示这个jsp页面,在其属性中有一个列表和一个getter public class Action extends Acti

我有一个带有组合框的表单,允许人们选择自己是男性还是女性。我想把男性和女性换成其他语言中相同的词

我的实际组合框是:

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

有没有办法用不同的语言放置这个组合框

最后,我找到了解决办法。我必须实现一个操作来显示这个jsp页面,在其属性中有一个列表和一个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;
    }
    ...
}
然后在jsp页面中,我使用此属性作为组合框中所需的列表

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