Grails 1.1 Web Application Development
上QQ阅读APP看书,第一时间看更新

What is scaffolding?

Scaffolding is a mechanism used in Grails to allow developers to generate web pages that perform basic CRUD (Create, Read, Update, Delete) operations on the classes that make up the domain model of the application. These "scaffolded" pages are a very useful low-cost mechanism that allows you to verify whether your domain classes are capturing all the necessary information. It is however, extremely rare for a scaffolding to be used in a version of the application released to users, as most web applications require more complex usage scenarios that can be provided through default scaffolding.

When scaffolding is enabled for a domain class, the following pages and actions will be available to work with that domain object:

  • List
  • Create
  • Edit
  • View
  • Delete

Scaffolding will handle:

  • Creation of the web pages
  • Mapping user input to the domain class
  • Validating the user input
  • Persisting the data to the database

We will see that it is possible to get a significant amount of value from these screens without needing to implement any application logic.