今天在项目上遇到统计分页页面的某个字段的总和,前台页面是使用FreeMaker实现的,记录一下:
<#assign tprice = 0 > <#list orderlist as order > <#if order.price??> <#assign tprice = tprice + order.price > </#if> </#list>
${tprice } <!#-- 输出结果 -->
今天在项目上遇到统计分页页面的某个字段的总和,前台页面是使用FreeMaker实现的,记录一下:
<#assign tprice = 0 > <#list orderlist as order > <#if order.price??> <#assign tprice = tprice + order.price > </#if> </#list>
${tprice } <!#-- 输出结果 -->