1.日期类型的数据进行插值
${time?string(“yyyy-MM-dd HH:mm:ss zzzz”)}
2.list集合的遍历
<#list week as day>
${day}
</#list>
输出的结果:就是list集合中的所有的元素
3.由于语句中不能包含><符号,用gt表示大于,lt表示小于
4.
${file.content!}
感叹号告诉 FreeMarker 对表达式自动检查 null 值和空字符串。如果 customer、invoice 或者 date 中有一个为空值或空字符串,你只会得到标签:
5.字符串的截取
第一种 ${content?substring(0,100)}
第二种:
<#if thing.title?length gt 33>
${thing.title?substring(0,30)}...
<#else>${thing.title!}
</#if>
6.引用其他的ftl文件
<#include "classf.ftl">
直接写名称,不用写路径