freemarker中list的创建以及list的遍历循环

取得list的长度:${list?size}?size不是用?length

${list?size}

freemarker中list的遍历循环

<#if list?? && (list?size gt 0)>
    <#list list as data>
        名称:${data.name!}
    </#list>
</#if>

list中有object,获取object的值

<#if lists?? && lists.tag_key??  && (tagliststag_key?size) gt 0 >
    <#list 0..lists.tag_key?size-1 as i>
        ${lists.tag_key[i]}
        ${lists.tag_url[i]}
    </#list>
<#else>
Last modification:October 24th, 2019 at 02:51 pm
如果觉得我的文章对你有用,请随意赞赏

Leave a Comment