Grails Controller Part 1


  • 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

You must have an active subscription to download PDF,Lab Zip and Recordings of this course topic.Please click the "Subscribe" button or the "Login" button if you already have an account.