freemarker中经常会在list的循环中使用自定义的变量,该变量随着list的循环进行加一操作,具体使用办法为:
<#assign x=0 />
<#list list as list>
<#assign x=x+1 />
${x}
</#list>
本文介绍在Freemarker模板引擎中如何实现循环遍历list时的自增计数功能,通过实例展示了具体的实现方法。
freemarker中经常会在list的循环中使用自定义的变量,该变量随着list的循环进行加一操作,具体使用办法为:
<#assign x=0 />
<#list list as list>
<#assign x=x+1 />
${x}
</#list>

被折叠的 条评论
为什么被折叠?