This is in my gsp and it do开发者_运维知识库esn't work
<g:select name="head.id" from="${com.hive.Persons.findAllByFirstname(${variable})}" optionKey="id" value="${organizationInstance?.head?.id}" />
I think that the main reason is that I am nesting ${}. How can I accomplish this. ${variable} is a string passed from the controller.
thanks!
You don't need the nested ${}
<g:select name="head.id" from="${com.hive.Persons.findAllByFirstname(variable)}" optionKey="id" value="${organizationInstance?.head?.id}" />
should work.
- Your
from
attribute should be populated in controller on the server side. - As a dirty hack you can use the following code:
<g:findAll in="${com.hive.Persons.findAll()}" expr="it.firstname == ${variable}">
<option>${it.firstname}</option>
</g:findAll>
精彩评论