Skip to content

Instantly share code, notes, and snippets.

@wspeirs
Created January 20, 2013 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wspeirs/4579982 to your computer and use it in GitHub Desktop.
Save wspeirs/4579982 to your computer and use it in GitHub Desktop.
Merging Velocity context and template together.
// get the template
final Template template = velocity.getTemplate("my_template.vm");
final StringWriter sw = new StringWriter();
// merge the template and context
template.merge(context, sw);
// print out the resulting document
System.out.println(sw.toString());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment