Thursday, November 6, 2014

reading java.util.List in velocity template

Assuming a list pass to the Velocity context.


List list = new ArrayList();
list.add("item1");
list.add("item2");
list.add("item3");

VelocityContext context = new VelocityContext();
context.put("list", list);


To get the list value,
below is the syntax in Velocity template

$list.get(0)

$list.get(1)

$list.get(2)


Done!!

LinkWithin

Related Posts Plugin for WordPress, Blogger...