Java Reference
In-Depth Information
Listing 7-12. Command for generating the application through static scaffolding
>grails generate-all bookstore.Book
Once you run this command from the command line or GGTS, Grails generates the application as
shown in the following output:
Loading Grails 2.2.4
| Configuring classpath.
| Environment set to development.....
| Packaging Grails application.....
| Packaging Grails application.....
| Generating views for domain class bookstore.Book
| Generating controller for domain class bookstore.Book
| Finished generation for domain class bookstore.Book
If we run the application now, we will have a complete CRUD application. This
generate-all
command generates one controller (
BookController
) and four views for our domain class
Book
and
generates one unit test for our controller,
BookControllerTest
. These files, which give us a complete
CRUD application, serve as stubs to which we can add custom code. Let's take a closer look at the
code we've generated. We begin with the
BookController
illustrated in Figure
7-28
.
Figure 7-28.
BookController