freemark 语法
我们通过后端model. addAttribute() 传递到前端的值来进行界面渲染
它的循环语句 和其他的有点不同:
if 循环
<#if 条件语句> </#if> |
if 循环 |
.
freemark需要搭配<#开始 然后</#结束
if循环:
<#if 判断条件> </#if>
<#if (list.menuList)?? && (list.menuList?size > 0)> 判断List.menuList存在并且大于0才能生效 <#list list.menuList as menulist> <li><a class="J_menuItem" href="/assets/${menulist.name}"> ${menulist.name} </a> </li> </#list> </#if
.
for循环 fremmark的for循环是list来表示的
<#list menuVOList as list> # 循环menuList 并且每一个都是list
</#list>
<#list menuVOList as list> <li> <a href="#">${list.menu.name} <span class="fa arrow"></span></a> <ul class="nav nav-third-level"> <#if (list.menuList)?? && (list.menuList?size > 0)> <#list list.menuList as menulist> <li><a class="J_menuItem" href="/assets/${menulist.name}"> ${menulist.name} </a> </li> </#list> </#if> </ul> </li> </#list>
判断变量是否存在
<#if (list.menuList)?? && (list.menuList?size > 0)> 判断list的menyList是否存在 并且长度大于0
.