我的形式传递该国的字符串名称给动作。我怎么能传递对象国的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使用

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top