Taking Control of Our Domain

The next step in implementing our first features is to give our users a way to create TekEvent instances. To do this, we will need a controller class. Controller classes are the dispatchers of a Grails application. All requests from the browser come through a controller. We will do quite a bit of work with controller classes later, but for now all we need is a blank one. Once again, Grails has a script to produce this:

 
$ ​grails create-controller com.tekdays.TekEvent

This will create the files grails-app/controllers/com/tekdays/TekEventController.groovy and test/unit/com/tekdays/TekEventControllerSpec.groovy,[19] along with a folder for views (this folder will be empty to begin with). Let’s open the TekEventController ...

Get Grails 2: A Quick-Start Guide 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.