Freemarker is a Java-based template engine.
In Freemarker, you can define a template in a text file. That template contains some place holders to populate the data, and some conditional statements, loops etc.,
Advantage
We can separate the presentation and business logic. Template contains the following sections.
a. Text: Text to be printed in output
b. Interpolation: Interpolations are delimited by ${ and } will be replaced with actual value at the time of merging
c. FLT tags: These are instructions given to FreeMarker, these will not print anything
d. Comments: Used to document the template. Comments can be placed inside ftl tags and interpolations.
Example
<#-- Include Demo -->
<#include "/copyright.ftl">
Hello ${name}, Welcome to the Application.
<#-- Include Demo -->: This is comment
#include: Ftl tag
${name}: Interpolation, replace the variable 'name' with the actual value supplied by model object.
Welcome to the Application: This is text
In which language template file is written?
Template file is written in FTL (FreeMarker Template Language).
Reference
https://freemarker.apache.org/
No comments:
Post a Comment