How to get a zero-based count in a Velocity foreach loop

前端 未结 4 1126
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-04 02:20

I am trying to get a zero-based counter in a Velocity #foreach directive.

if i use:

#foreach ($item in $list)
   item.getName() : $veloc         


        
4条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-04 02:43

    According to the doc, you can specify:

    directive.foreach.counter.initial.value = 0
    

    In velocity.properties file.

提交回复
热议问题