Grails Controller Part 1
Topics
- Controller and actions
- Scopes
- Models and views
- Rendering
- Controller interceptors
- Redirecting
- Data binding (params)
- XML and JSON responses
Controllers & Actions
Method vs Closure as Actions
- Actions in a controller can be in the form of
- method or
- closure
- Methods are preferred (over closure) because they are
- Memory efficient
- Allow use of stateless controllers (singleton scope)
- You can override actions in subclasses
- Methods can be intercepted with standard proxying mechanisms, something that is complicated to do with closures – this is because, in closure, the actions are in the form of fields
Download course content