CHAPTER 7: Rapid Web Development with Grails 329
Static Scaffolding
Static scaffolding provides an excellent learning tool to help you familiarize yourself with the Grails
framework and how everything fits together. Now, it is the time to see static scaffolding in action as a
learning tool. There is no difference in the domain class for both dynamic and static scaffolding. For
quick reference, the Book class is shown in Listing 7-11.
Listing 7-11. Book Domain Class
package bookstore
class Book {
String bookTitle
Long price
Long isbn
static constraints = {
bookTitle(blank:false)
price(blank:false)
}
String toString() {
bookTitle
}
}
Static scaffolding differs from dynamic scaffolding in the way that views and controllers are generated.
The domain class remains the same in both cases. However, in dynamic scaffolding, you need the
controller to indicate to Grails that you need the dynamic scaffolding to generate the application for
you. If you want Grails to generate the application through static scaffolding, you have to use the
command in Listing 7-12.
Figure 7-27. List view with list of added books