(Quick Reference)

create-controller

Purpose

The create-controller command will create a controller and associated integration test for the given base name.

Examples


grails create-controller book

Description

Creates a controller for the given base name. For example for a base name "book" a controller called BookController will be created in the grails-app/controllers directory.

A controller is responsible for dealing with incoming web request and performing actions such as redirects, rendering views and so on. For more information on controllers refer to the section on Controllers

Note that this command is merely for convenience and you can also create controllers in your favourite text editor or IDE if you choose.

Usage:

grails create-controller [name]

Fired Events:

  • CreatedFile - When the controller is created