ali haider
ali haider

Reputation: 20232

for loop in play framework 1.2.5 (groovy template)

I am using the following code to use the for loop with a list (I am familiar with the other syntax copied below as well). The first for loop is not working for me even though its the same list. Any ideas on how to go about troubleshooting this:

#{list items:0..items.size(), as:'item'}${item}#{/list}  //Not Working - I have tried moving the items.size out of the loop as well but it has not worked for me

This is working for the same list:

#{list items, as:'item'}${item}#{/list}

Any thoughts/suggestions why? Thanks in advance.

Edit: The list is that of user defined instances (primarily holding Strings and Integers)

Upvotes: 0

Views: 675

Answers (1)

Seb Cesbron
Seb Cesbron

Reputation: 3833

The syntax is incorrect, the items parameter need an iterable and you give it an integer, if you need an index you can use the item_index variable

Upvotes: 1

Related Questions