freemarker 判断list记录大于0

freemarker 判断list记录大于0 用<#if (list?size > 0)></#if>即可。下面是个显示附件的实例

<#if (post.attachments?size > 0)>
      <table width="100%" height="20px" cellpadding="0" cellspacing="0" class="post_bodyTable">
       <tbody>
        <tr>
         <td class="post_body_text" valign="bottom">
          相关附件:
          <#list post.attachments as attach>
           链接:<a href="${attach.physicalFilename}">${attach.realFilename}</a>&nbsp;
           大小:${attach.filesize}&nbsp;描述:${attach.description}&nbsp;上传日期:${attach.uploadDate}
           <br />
          </#list>
         </td>
        </tr>
       </tbody>
      </table>
      </#if>

你可能感兴趣的:(freemarker)