CHAPTER 7: Rapid Web Development with Grails 315
Click Finish. GGTS will generate the controller and tests, as illustrated in the following output:
Loading Grails 2.2.4
| Environment set to development.....
| Created file grails-app/controllers/bookstore/BookController.groovy
| Created file grails-app/views/book
| Compiling 1 source files.....
| Created file test/unit/bookstore/BookControllerTests.groovy
Listing 7-3 illustrates the generated controller.
Listing 7-3. BookController Generated by Grails
package bookstore
class BookController {
def index() {
}
}
Now refresh the browser and you can see this controller on the Welcome screen as illustrated in the
Figure 7-14.
Figure 7-13. Creating a controller using GGTS
To create the controller using GGTS, click the controllers in the bookstore project hierarchy, and then
use New ➤ Controller. Type Book in the Grails Command Wizard, as shown in Figure 7-13.