As far as I know, if I want to create an action in a controller then I can do it by:
class My Controller {
def myAction = {
println \"in my action \"
I'm not sure, but I think that it used to be the first way was the only way to do it, and then it changed to allow the second way. I think that the second way is the preffered way, but I'm not sure.
[Edit]
Here is another stack overflow post further explaining it:
Why should grails actions be declared as methods instead of closures and what difference does it make?
Leveraging methods instead of actions(Closure properties) has some advantages:
Please visit following link for more information.
Grails controllers
The first implementation was defining public closures in the controller, the second is to use public methods.
The second way was introduced in grails 2, and is widely considered to be the best way.
A couple of reasons i can think of from the top of my head:
UPDATE: Why should grails actions be declared as methods instead of closures and what difference does it make?