What is the best way to ensure HTML entities are escaped in StringTemplate
Assuming the following string template, is being given a list of Java Bean objects: <ul>$people:{p|<li>$p.name$ $p.email</li>}$</ul> ie the list of people might contain Person objects which you may or may not have the ability to enhance/extend: class Person { .... public getName() { ... } public getEmail() { ... } } The getName() and getEmail() methods don't return sanitised (escaped html entities). How do you get around this? You may use a custom renderer, for example: public static class HtmlEscapeStringRenderer implements AttributeRenderer { public String toString(Object o, String s, Locale