ftl FreeMarker
変数定義
<#assign hoge=33>
変数表示(↑で定義した場合)
${hoge}
マクロ定義
<#macro name arg arg2="">
#macro>
マクロ呼び出し
(外部ファイルでマクロを定義した時はincludeが必要なことに注意)
<#include 'macros.ftl'/>
<@macro_name arg="hoge" arg2="fuga">
@macro_name>
制御文
<#if a==33>
<#else>
#if>
<#if a==b>
<#elseif b == 33>
#if>
switch-case文
<#switch being.size>
<#case "small">
This will be processed if it is small
<#break>
<#case "medium">
This will be processed if it is medium
<#break>
<#case "large">
This will be processed if it is large
<#break>
<#default>
This will be processed if it is neither
#switch>
for each
<#list dog_list as dog>
${dog}
#list>
コメント
<#--- comment -->
存在するか
<#if a??>
#if>
存在しないか
<#if !a??>
#if>
has_content
「??」は変数が存在すればtrueを返す
「?has_content」は変数が存在してかつ中身が空でないときにtrueを返す
エラーコレクション
freemarker.core.ParseException: Unexpected end of file reached.