I am using velocity 1.7 and within a foreach loop I want to print the count. In the template I have the following string in a #foreach/#end section:
Count: $foreach.count
and was expecting to see in the rendered result something like
Count: 1
...
Count: 2
...
but all I see is:
Count: $foreach.count
...
Count: $foreach.count
...
Any ideas what am I doing wrong?
Your code is partial, we don’t see the foreach directive.
Else, I know that the foreach loop has a built-in variable called
$counter, though in the guide they do refer to$foreach.count