Skip to content

Instantly share code, notes, and snippets.

@wspeirs
Created January 20, 2013 17:15
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/4579956 to your computer and use it in GitHub Desktop.
Save wspeirs/4579956 to your computer and use it in GitHub Desktop.
Setting the Velocity context.
// create the context to set all the variables
final VelocityContext context = new VelocityContext();
// setup the context
context.put("user", new UserBean("bill"));
context.put("site", "www.sop4j.com");
context.put("articles", Arrays.asList(new ArticleBean("Welcome"),
new ArticleBean("Parsing the Command Line"),
new ArticleBean("Document Templating or Mail Merge")));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment