【发布时间】:2009-11-13 13:23:36
【问题描述】:
这在 GSP 页面中按预期工作:
<td>${Foo.findAllByBar(bar)}</td>
但是当添加一个收集语句时,代码会中断..
<td>${Foo.findAllByBar(bar).collect { it.name }}</td>
与
Error 500: Could not parse script [...gsp]: startup failed,
...: 129: expecting '}', found ')'
@ line 129, column 196. 1 error`.
我的印象是任何有效的 Groovy 代码都可以放在 GString ${ ... } 中并被正确评估/扩展。我错过了什么?
【问题讨论】: