Blog
Loops in GSP
8 Oct, 14

Loops in GSP

Loops are one of the most important and useful part of every programming language. Grails provides various loops in controller and view. Following are the loops in GSP: each: each tag is used to iterate over each element of a list. <g:each...
Loops In Groovy
1 Sep, 14

Loops In Groovy

There are several types of loops in groovy. Following are some of the ways: List list = [4, 2, 9, 6, 7, 8, 2] for loop: for (int i = 0; i < list.size(); i++) { print list.get(i) } output = 4296782 for (int i : list) { print i } output = 4296782 for (int i...
Sort List In Groovy
31 Aug, 14

Sort List In Groovy

If we have a simple list like [code]List list = [4, 2, 9, 6, 7, 8, 2][/code] 1 [code]List list = [4, 2, 9, 6, 7, 8, 2][/code] We can easily sort this list using [code]assert list.sort() == [2, 2, 4, 6, 7, 8, 9][/code] 1 [code]assert list.sort() == [2, 2, 4, 6, 7, 8,...