2014-02-14 140 views
1

我有一个选择必须使用String列表填充其选项。选项值和文本将等于。Struts2 - 如何使用String列表填充选择标签?

我知道我正在发送清单,因为选择渲染一些元素等于列表的大小。

<s:select name="status" list="status" headerKey="" headerValue="-- Select --" id="status" listKey="" listValue="" /> 

会发生什么情况是,期权没有价值和文本渲染,因为我没有一个关于我应该是指在Struts2的taglib的选择标签的listKeylistValue属性什么头绪。

在操作的方法:

public List<String> getStatus() { 
    return Arrays.asList("Active", "Inactive"); 
} 

回答

3

如果省略lisKeylistValue属性,那么Struts2的将使用字符串文本作为键和值。

尝试:

<s:select name="status" list="status" headerKey="" headerValue="-- Select --" id="status" /> 
+0

工作就像一个魅力。 –

相关问题