freemarker常用语法

①:限制取出的字段的值:从第0位到第2位。

[0..2]


②:通过_index取出list中前3条数据。

<#if (list_index < 3) >

</#if>


③:遍历list。

<#list  studentList as sut>

${stu.name}

</#list>


④:if-else-if语句格式。

<#if (条件)>

<#elseif (条件)>

<#else>

</if>


⑤:引入页面。

<#include "header.html"/>


⑥:定义变量。

<#assign i = 1/>


⑦:判断是否为空。

student??


⑧:为空用“-”代替。

${stu.name!"-"}



猜你喜欢

转载自blog.csdn.net/qq_36135928/article/details/80223329