Search code examples
jquerygrailsgspjquery-templates

Grails interferes with jquery-tmpl syntax


The jQuery templates plug-in uses ${foo} syntax (example in jquery.tmpl doc):

$.tmpl( "<li>${Name}</li>", myData )

But Grails also uses it (example in Grails doc):

<body>
  Hello ${params.name}
</body>

So when I include $.tmpl( "<li>${Name}</li>", myData ) in my .gsp, Grails renders it as $.tmpl( "<li></li>", myData );.

Is there an easy way around this?


Solution

  • use the alt syntax: {{= Name }}

    http://api.jquery.com/template-tag-equal/