我的表单是将国家/地区的字符串名称传递给操作。我怎样才能将对象国家的ID从组合框传递到动作?
这就是我所拥有的:
s:combobox label =“Country”name =“country”headerValue =“Select”headerKey =“1”list =“%{countries}”listValue =“name”/>
感谢。
答案 0 :(得分:1)
您错过了 listKey 属性。 如果您将其更改为:
<s:combobox label="Country" name="country" headerValue="Select" headerKey="1"
list="%{countries}" listValue="name" listKey="id"/>
它可能会奏效。
有关所有可用属性,请参阅http://struts.apache.org/2.0.14/docs/combobox.html。