模板引擎的目标是”数据+模板=结果”
模板引擎将数据与展现有效”解耦”
JSP与Freemarker比较

FTL取值
${属性名} 取值,可对属性进行计算
${属性名!默认值} 使用默认值
${属性名?string} 格式化输出
if分支判断
<#if 条件1>
条件1成立执行代码
<#elseif 条件2>
条件2成立执行代码
<#elseif 条件3>
条件3成立执行代码
<#else>
其他情况下执行代码
switch分支判断
<#switch value>
<#case refValue1>
...
<#break>
<#case refValue2>
...
<#break>
<#case refValueN>
...
<#break>
<#default>
...
</#switch>
list迭代列表
<#list students as stu>
<li>${stu_index}-${stu.name}</li>
</#list>
${stu_index}为下标,从0开始
list迭代Map
<#list map?keys as key>
${key}:${map[key]}
</#list>
list数字序列迭代
<#list 1..20 as x>
<li>${x}</li>
</#list>
内建函数:
