Grails - Controllers

Grails Controllers

What is a controller?

A controller handles requests and creates or prepares the response. They can generate the response or delegate to a view. To create a controller simply create a class whose name ends with "Controller" and place it within the "grails-app/controllers" directory.

The first part of your controller name is mapped to a URI and each action defined within your controller maps to URI within the controller name URI.

Controllers are request-scoped. A new instance is created for each request.

Further Reading

  1. Creating Controllers and Actions
  2. Controllers Scopes
  3. Data Binding
  4. Models & Rendering Views
  5. Redirects & Chaining
  6. Interceptors
  7. File Uploads
  8. Dependency Injection