I am writing a blog about Velocity, Which is an open source templating technology. Velocity is java technology based template engine.
Here, We will take reference of objects/variable which is defined in Java code with the Velocity template language. A Velocity template is also used for user interface in web applications. Velocity templates helps to achieve the presentation layer and the business logic implementation in the liferay portal.
Now, We will discuss about various Velocity template language (VTL) syntax below :
velocity template statements starts with # as below example
#set ($temp = Bhagwan Singh)
Below example help to understand Conditional statements in velocity.
#set ($temp = 99)
#if( $temp > 100 )
<b>The variable is greater than </b>
#elseif( $temp < 100 )
<b>The variable is less than 100</b>
<b>Not matching any conditions</b>
In below code collection is an arbitrary collection. In each iteration $obj holds the item.