Velocity
uses references to pass dynamic content into web pages. Macros and variables are a few of these references types used to reference objects defined within the Java code or can receive values inside the web page through a VTL declaration. Setting and using objects uses the #
character:
#set ($firstName = "Jimmy") #set ($lastName = "Gimme") #set ($age = 35) $firstName $lastName $age
FreeMarker Templating Language (FTL) can define expressions, functions, and macros within the templates and can use a rich library with predefined directives that give us the possibility to iterate data collections, include other templates, and much more. Setting a variable in FTL uses the #
symbol:
<#assign firstName = "Jimmy" > <#assign lastName = "Gimme"> <#assign magazineUrl = 35>
In FTL, predefined directives are called by <#directivename parameters>
, the macros with <@macro parameters>
, and the expressions...