Moon Moon - 2 years ago 75
Java Question

How to use 'for' loop in velocity template?

I just googled for 'for loop', but it looks like velocity has 'foreach' only.

How do I use 'for loop' in velocity template?

Answer Source

There's only #foreach. You'll have to put something iterable on your context. E.g. make bar available that's an array or Collection of some sort:

#foreach ($foo in $bar)

Or if you want to iterate over a number range:

#foreach ($number in [1..34])
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download