CHAPTER 4Understanding Controllers
A Grails controller is a class that is responsible for handling requests coming in to the application. The controller receives the request, potentially does some work with the request, and finally decides what should happen next. What happens next might include the following:
- Execute another controller action (possibly, but not necessarily, in the same controller)
- Render a view
- Render information directly to the response
A controller is prototyped, meaning that a new instance is created per request. So developers don't need to be as cautious about maintaining thread-safe code in a singleton controller.
You can think of controllers as the orchestrators of a Grails application. They provide the main entry point ...
Get The Definitive Guide to Grails, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.