I want to create for statement in freemarker template. I am reading howto http://freemarker.sourceforge.net/ but there is just list. How can i create for statement or foreach.
parameter.put("size", size);
I want to create in freemarker template for statement like
for (int number = 1; number <= size; number++) {
You can use
list
directive:From the Freemarker manual you can do:
Edit: Beware, if
x
is 0 (or less), it will count backwards. So you mostly want1 ..< x
, which excludesx
(this requires FreeMarker 2.3.22).