Reputation: 2734
I need to write some javascript in a GSP that contains the character sequence ${} (OpenLayers Style - Attribute Replacement Syntax). Unfortunatly, this is also the syntax for a groovy gstring expression. How do I escape it so that Grails does not interpret the character sequence as a gstring. I have tried '\' but that did not work.
Upvotes: 4
Views: 3568
Reputation: 122364
The way I usually do this is
${'${test}'}
or alternatively
${'$'}{test}
Note the use of single rather than double quotes - ${"${test}"}
would not work because the inner ${}
would be interpreted as a GString rather than a literal.
Upvotes: 5