template.merge(context, tempWriter);
return tempWriter.toString();
}
public static Template getTemplate(String templateName) throws Exception {
VelocityEngine velocityEngine = VelocityManager.getInstance().getVelocityEngine();
/*
* if (velocityEngine == null) { velocityEngine = new VelocityEngine();
* Properties props = new Properties();
* props.load(ClassLoaderUtils.getResourceAsStream("test-velocity.properties",
* com.opensymphony.webwork.portlet.sitemesh.VelocityUtils.class));
* props.list(System.out); velocityEngine.init(props); }
*/
String encoding = "UTF-8";
Template template = velocityEngine.getTemplate(templateName, encoding);
return template;
}