0

这是我的单选按钮代码。

<s:radio name="filter" requiredposition="right"
list="#{'STATUS_FILTER_START':'START','STATUS_FILTER_END':'STOP'}" 
 value = "STATUS_FILTER_START"></s:radio>

或者

<s:radio name="filter" requiredposition="right"
list="#{'STATUS_FILTER_START':'START','STATUS_FILTER_END':'STOP'}" 
 listValue = "STATUS_FILTER_START" listKey =  "STATUS_FILTER_START"s></s:radio>

但没有任何效果。
有人可以帮我吗?我不想要 html:radio 标签。

4

2 回答 2

3

也适用于使用静态值的开发人员。这是解决方案:

<s:radio label="correctOption" name="correctAnswer" list=" 
#{'1':'1','2':'2','3':'3','4':'4'}" value="1"/>

另一种情况是静态列表中的字符串:

<s:radio label="Gender" name="gender" list=" 
    #{'male':'Male','female':'Female'}" value="'male'"/>
于 2014-03-24T13:37:45.633 回答
2

在你的动作类中设置默认值,并在 OGNL 中使用它来告诉选择哪个值作为默认值

List<String> filter= new ArrayList<String>();
        filter.add("START");
        filter.add("STOP");


    public List<String> getFilter() {
        return filter;
    }
    public String getDefaultFilterValue(){
        return "STOP";
    }

在你的jsp中使用喜欢

<s:radio label="filter" name="filter" list="filter" value="defaultGenderValue" />

我使用了简单的 ArrayList,但您可以自由使用 Map。

于 2012-04-04T06:12:41.583 回答