Controllers are the entry point for your application's logic. Each controller has access to their model and view instances from their respective MVC group.

Controller actions are usually defined using a closure property form, like the following one

class MyController {
    def someAction = { evt = null ->
        // do some stuff
    }
}

It is also possible to define actions as methods, however the closure property form is preferred (but not enforced). The caveat is that you would need to translate the method into a MethodClosure when referencing them form a View script. In the following example the action 'action1' is defined as a closure property, whereas the action 'action2' is defined as a method

application(title: 'Action sample', pack: true) {
    gridLayout(cols: 2, rows: 1) {
        button 'Action 1', actionPerformed: controller.action1
        button 'Action 2', actionPerformed: controller.&action2
    }
}

Actions must follow these rules in order to be considered as such:

Controllers can perform other tasks: