Can someone tell me the difference between :
<g:if test="${foo.bar}">
and
<g:if test="\${foo.bar}">
A real exemple of the use of "\" before the "$" is :
<g:if test="\${flash.message}">
Thank you.
\${...}
will put a literal dollar-brace into the output rather than evaluating the contents as an expression. I rarely have need to use this in a normal GSP but it's very common in scaffolding templates where the template engine uses the same ${}
syntax for its own generation-time expressions as the generated GSP uses at runtime - so you need \${}
in the scaffolding template to generate expressions in the GSP which will then be evaluated for real at runtime when the page is rendered.