package com.javahonk;

import java.io.StringWriter;
import java.util.ArrayList;
import java.util.List;

import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;

public class IterateListVelocityTemplate {

	public static void main(String[] args) {
		
		VelocityEngine ve = new VelocityEngine();
		ve.init();
		Template t = ve.getTemplate("./src/main/resources/templates/SampleRenderList.vm");
		VelocityContext vc = new VelocityContext();
		vc.put("velocity", "Iterate List Velocity template");
		List<String> bar = new ArrayList<String>();
		bar.add("Test");
		bar.add("Test");		
		vc.put("bar", bar);
		StringWriter sw = new StringWriter();
		t.merge(vc, sw);
		System.out.println(sw);
	}

}
