开发者

How do I nest ${} in gsp

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.


  1. Your from attribute should be populated in controller on the server side.
  2. 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>

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜