Sunday 14 June 2020

FreeMarker: Directives

FTL tags are used to call directives. For example, we can define id directive like below.

 

Example

<#if user.gender == "Male">

  ...

  ...

</#if>

 

There are two kinds of FTL tags used to compose ‘if’ directive.

 

a.   Start-tag: <#directivename parameters>

b.   End-tag: </#directivename>

 

Not all the directives required to have 'end' tag. For example, ‘include’ directive do not have any content, so it does not have any end tag.

 

Example

<#include something>

 

Types of Directives

Freemarker has two kinds of directives.

a.   Predefined Directive: Directives defined by FreeMarker. Example: if, list, include

b.   Userdefined Directive: Directives that are defined by user.



Previous                                                    Next                                                    Home

No comments:

Post a Comment