【发布时间】:2011-08-17 08:34:18
【问题描述】:
这个问题是问题here的延续。
下面的代码来自我的一个观点,它工作正常,但我很难将此代码移动到控制器。如果我的包和类从下面的代码中看不清楚,请看上一个问题,看看它们是如何排列的。
<g:set var="roleAdmin" value='${org.me.example.userrole.Role.findByAuthority("ROLE_ADMIN")}' />
<g:set var="roleOfficeProfessional" value='${org.me.example.userrole.Role.findByAuthority("ROLE_OFFICE_PROFESSIONAL")}' />
<g:set var="roleDriver" value='${org.me.example.userrole.Role.findByAuthority("ROLE_DRIVER")}' />
<g:select name="loggedBy.id" from="${org.me.example.userrole.UserRole.findAllByRoleInList([roleAdmin, roleOfficeProfessional, roleDriver]).user}" optionKey="id" value="${loadInstance?.loggedBy?.id}" />
这可能是我的一个基本误解,但我无法让我在控制器中创建的任何方法在我的视图中工作,只有 Grails 创建的方法(即list、create 、delete、edit 等)将起作用。任何帮助/建议都会有所帮助。
【问题讨论】: