【发布时间】:2017-01-30 20:09:08
【问题描述】:
我有一个 grails 应用程序,带有一个类似的控制器 -
def query = {
def options = ['X', 'Y', 'Z']
if (some criteria matches) {
render(view: "queryws", model: [opts: options])
}
}
在我的 gsp 中,我试图将值检索为 -
<tr>
<td><label for="env">Options:</label></td>
<td><g:select name="env"
from="${opts.list()}" id="select"
value="${params.env}" /></td>
</tr>
【问题讨论】:
-
你的意思是你没有看到
params.env?您只是在模型中传递opts。 -
不,我没有在下拉菜单中看到“选择”。
-
试试
from="${opts}"而不是.list()调用。