freemarker 判断list记录大于0

阿超 发表于 2009-08-29 22:22 | 来源: | 阅读 500 次

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>

喜欢Java豆技术站点的文章,那就通过 RSS Feed 功能订阅阅读吧!

我要评论

*

* 绝不会泄露



返回首页 | 关于我们 | 联系我们 | 广告合作 | 网站地图 | 友情链接 | 版权声明 | 模板设计