Java Mailing List Archive

http://www.gg3721.com/

Home » user.groovy »

[groovy-user] SimpleTemplateEngine and HTML Entities

simonz

2008-08-25


Author LoginPost Reply

Hello all,

What the nicest solution is for escaping HTML special chars like <, >, & etc
inside a Groovy template using the SimpleTemplateEngine?  For example, in
the following template, how would I make sure the person's name is correctly
rendered in the event it contains special chars?

<html>
<body>
  Hello $firstName $lastName
</body>
</html>

At the moment I made it just call into existing Java libraries to do the
escaping but I'm wondering if there's a more Groovy way to do it?

Cheers & thanks in advance!

Simon.


--
Sent from the groovy - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email


©2008 gg3721.com - Jax Systems, LLC, U.S.A.