How can we create and access object in apache velocity template?

It is really easy to create and access objects in apache velocity template. Following is an example of creating object in velocity template:

#set ($titleSizes = {
"dynamicLayoutEightColumn" : 32, 
"dynamicLayoutTwoSmallStack" : 26,
"breakingNewsTeaser" : 46, 
"singleMediumTeaser" : 43
})

Accessing the object is also very easy in apache velocity template. Following is the way to access the object in velocity:
$titleSizes.get("breakingNewsTeaser")

Comments