0

嘿。我有这个控制器:

def participated_favourite = {

        def user = User.get(1)
        def conferenceUser

        def original = ConferenceUser.findAllByUser(user)
        def temp = ConferenceUser.findAllByUserAndIsFavourite(user, 1) // all conferenceUser filtered by User

        def priz = [:]
        def subm = [:]

  ...
  ...

  [temp: temp, priz: priz, subm: subm, orig: original]
}

我现在希望能够在 selectBox 中选择“原始”通过的会议列表(在参与的_favourite.gsp 中)。

我怎样才能做到这一点?

<g:select name="" from="${orig.list()}" optionKey="id" value=""  />

这给了我一个不应该的空选择框。因为我的数据库中有一条记录。我究竟做错了什么?感谢提前,


编辑_ _ __ _ __ _ __ _ __ _

我在相同的 gsp 中有以下内容:

<g:each var="it" in="${orig}">
 <table cellspacing="2">
                <tbody><tr>
                   <th>Name</th>
         </tr>
                    <tr>
                   <td class="color1">${it.conference}
</td>
</tr>
</tbody>
</table>
   </g:each> 

它是 p+rinting 值。所以我不知道选择中的问题是什么..

4

2 回答 2

0

尝试给name属性一个值。

- -编辑 - - -

请尝试以下方法进行故障排除:

这行得通吗?

<g:select from="${ConferenceUser.list()}" />

如果是这样,这个怎么样?

<g:select from="${ConferenceUser.list()}" optionKey="id" />

于 2011-05-28T17:38:39.640 回答
0

利用

<g:select name="" from="${orig}" optionKey="id" value=""  />
于 2011-05-28T17:24:45.070 回答