299
Chapter 7
Rapid Web Development
with Grails
Live in fragments no longer, only connect.
—Edgar Morgan Foster
Grails takes web development to the next level of abstraction. The fact that Java EE was not
written with an application level of abstraction led to the development and subsequent popularity
of Java frameworks such as Spring, Hibernate, and so on. But most of the Java frameworks take
a fragmented approach toward web development. You have to maintain the configuration for each
layer. Grails embraces convention over configuration and wraps these powerful frameworks with a
layer of abstraction via the Groovy language, thus providing a complete development platform that
allows you to take full advantage of Java and the JVM.
This chapter will reach under the covers of the Grails machine and look at its parts: its wheels and
gears all moving in a coordinated motion, its workability, its leading-edge engine, and its underlying
form. It will take a closer look at the interactions in the Grails ecosystem. It will show how controllers
handle, manage, direct, and orchestrate the logical flow of the application and how they handle
requests, redirect requests, execute and delegate actions, or render views as the need arises. It
will explore views and unravel how Grails uses SiteMesh, the page decoration framework, to give a
consistent look to pages, as well as how views draw on Grails’ built-in tags and dynamic tags in its tag
library to create well-formed markup and promote a clean separation of concerns. It’s quite a machine.
Grails Features
Grails is a request-based, MVC, open-source web development framework. More than just that,
though, it is a complete development platform in which everything runs on top of the robust Java
and Java EE platforms as illustrated in Figure 7-1. It leverages the existing popular Java frameworks,