【发布时间】:2015-03-02 12:12:37
【问题描述】:
我正在使用 g:select 来填充来自控制器的列表! i pass the selected value as well from the controller when the select changed and submitted !
<g:select id="select"
name="select"
from="${someList}"
value="${passedParameter_selectedValue}"
noSelection="${['':'sth']}"
optionValue='name'
optionKey="id"
/>
当我在提交值后调试它时,我的页面会用来自控制器的列表刷新!所以选择在一次迭代后具有( Value )然后它变为 null !
问题是当我不使用 optionKey 时它运行良好!
【问题讨论】:
-
值应与 optionKey 相同,例如您的 optionKey 是
id,因此value也应该是实例的 id,请尝试value="${passedParameter?.id}" -
请从控制器中添加相关部件。
-
非常感谢!就是这个值应该和 optionKey 一样!贴出来让我接受答案