How to write for loop in groovy in play framework?

479 views
Skip to first unread message

$e$hu

unread,
Apr 19, 2011, 10:24:06 AM4/19/11
to play-framework
HI

can any one tell me about how to write for loop in groovy.I ahve
written like this.

%{ for( reservations.size() >0 && reservations.size()<= 40) { }%
some thing .......
%{ } }%

But Its showing an error that heap storage full.
but I can't get succeded in that.could any body do this,plz help me.
I ahve tried as list also like
%{ x =40 }%
%{ i =1 }%
#{list reservations.size()>0 && reservations.size()<= (x*i) }
<li><a href="@{JobLists.inlist(i)}">${i}</a></li>
%{i++}%
#{/list}

thanks if so,,,

Julien Richard-Foy

unread,
Apr 19, 2011, 10:40:58 AM4/19/11
to play-fr...@googlegroups.com
You’ll find answers here: http://groovy.codehaus.org/Looping and
there: http://www.playframework.org/documentation/1.2/tags#list
I suggest you to follow the Play! tutorial :)

Alexander Reelsen

unread,
Apr 19, 2011, 11:53:15 AM4/19/11
to play-fr...@googlegroups.com
Hi

On Apr 19, 2011, at 4:24 PM, $e$hu wrote:

> can any one tell me about how to write for loop in groovy.I ahve
> written like this.
>
> %{ for( reservations.size() >0 && reservations.size()<= 40) { }%
> some thing .......
> %{ } }%

I dont really get what you want to do... Simply counting up a list?
This is how you would do this:

#{list 1..20, as:'i' }
${i}
#{/list}

Feel free to explain if I didnt get you right..


--Alexander

Reply all
Reply to author
Forward
0 new messages