Struts2的组合框 - 通过整数ID而不是字符串名称通过表单的动作
题
我的形式传递该国的字符串名称给动作。我怎么能传递对象国的ID从组合框的动作?
这是我有:
S:组合框标签= “国家” 名称= “国” headerValue = “选择” headerKey = “1” 列表= “%{}国家” listValue = “名称”/>
感谢。
解决方案
您已经错过的 listKey 强>属性。 如果你改变它为:
<s:combobox label="Country" name="country" headerValue="Select" headerKey="1"
list="%{countries}" listValue="name" listKey="id"/>
有可能会工作。
请参阅 http://struts.apache.org/2.0.14/对于所有属性文档/ combobox.html使用。
不隶属于 StackOverflow