I'm new to grails and would just like to learn one at a time.
How can I call an action from another action in the same controller:
class ListProjectsController {
def index () {
redriect(action: sampleMethod)
}
def sampleMethod () {
//some codes here
}
}
I tried redirect but this caused some error, help please?
here is a picture of the error message
http://i24.photobucket.com/albums/c22/Klifford_Kho/Capture_zps5j8nov9f.png
That's the old style from before Grails 2 when actions were closures. You could quote the name or refer to the closure directly by name. When using methods you can't refer to them as objects, so you just have to quote the name:
redirect(action: 'sampleMethod')