日期:2014-05-17  浏览次数:20745 次

请问select标签的选项值,如何在提交表单时映射回struts的Action属性中呢?
XML code

<s:select name="deptCode" list="deptOptions" listKey="code" listValue="name" emptyOption="true"></s:select>


列表已经正确绑定到页面上了,只是submit的时候,选项的值无法设置回deptCode属性中。请问是什么原因呢?

------解决方案--------------------
你是不是提交过后,返回页面时,deptCode没有显示提交时设置的值?
如果是上面这种情况,你返回时必须要保证deptOptions要有值。
且后台必须有deptCode这个属性,这样才能映射!
------解决方案--------------------
选中后用from表单提交到Action就可以了
------解决方案--------------------
探讨
XML code


<s:select name="deptCode" list="deptOptions" listKey="code" listValue="name" emptyOption="true"></s:select>
列表已经正确绑定到页面上了,只是submit的时候,选项的值无法设置回deptCode属性中。请问是什么原因呢?