private void renderBlock(HttpServletResponse res, String templateName,
			Map<String, String> properties) throws IOException {
		InputStream is = null;
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		String template = null;
		try {
			is = getClass().getClassLoader().getResourceAsStream(templateName);
			if (is != null) {
				IOUtils.copy(is, baos);
				template = baos.toString();
			} else {
				throw new IOException("Unable to load template " + templateName);
			}
		} finally {
			IOUtils.closeQuietly(is);
			IOUtils.closeQuietly(baos);
		}
		StrSubstitutor sub = new StrSubstitutor(properties);
		res.getWriter().write(sub.replace(template));
	}
private void renderBlock ( HttpServletResponse res , String templateName , Map < String , String > properties ) throws IOException { InputStream is = null ; ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; String template = null ; try { is = getClass ( ) . getClassLoader ( ) . getResourceAsStream ( templateName ) ; if ( is != null ) { IOUtils . copy ( is , baos ) ; template = baos . toString ( ) ; } else { throw new IOException ( "Unable to load template " + templateName ) ; } } finally { IOUtils . closeQuietly ( is ) ; IOUtils . closeQuietly ( baos ) ; } StrSubstitutor sub = new StrSubstitutor ( properties ) ; res . getWriter ( ) . write ( sub . replace ( template ) ) ; }
Loads the template with the specified name from the classloader and uses
it to templatize the properties using Apache Commons Lang's
StrSubstitutor and writes it to the response.

@param res
the response to write to
@param template
the template file to load from the classpath
@param properties
the properties to templatize
@throws IOException