码迷,mamicode.com
首页 > 编程语言 > 详细

FreeMarker中List排序

时间:2014-10-15 11:59:10      阅读:118      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   ar   sp   div   on   log   代码   

有时候需要在页面上对list排序,虽然也可以在后台代码中完成,但这个可能要看具体情况。
排序的样本代码如下:

<#list resultMap.topViewList?sort_by("monthlyViewedCount") as tvl>
.............................................
</#list>

monthlyViewedCount是list中对象的属性。默认情况下是升序,如果你要降序:

<#list resultMap.topViewList?sort_by("monthlyViewedCount")?reverse as tvl>
.............................................
</#list>

FreeMarker中List排序

标签:style   blog   color   ar   sp   div   on   log   代码   

原文地址:http://www.cnblogs.com/eastson/p/4025717.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!