Apache Velocity Part 2 – Loop (foreach)

This tutorial is about #foreach loop in velocity.

Velocity has #foreach element for looping. Please find below template for more details.

Please click this link for Velocity Dependency & Introduction.

Loop starts with #foreach and ends with #end

Note : #foreach can only accept java java.lang.Iterable implementation. Like List, Set etc

Find below code example.

Output :