small medium large xlarge

Grails 2: A Quick-Start Guide


Cover image for Grails 2: A Quick-Start Guide

Grails 2: A Quick-Start Guide


Java web development is notoriously tedious, but help is on the way. Grails takes the pain out of web development and brings back the fun. This beginner’s guide gets you up and running with Grails as you construct an original, working application from start to finish. In this new edition, you’ll be building an application entirely with Grails 2, which allows you to take advantage of the new HTML 5 scaffolding, dramatic performance improvements, and enhancements new to Groovy 2.

Choose Your Format(s)

  • $46.00 In Stock

    Save $14.00 on the combo pack.

  • $36.00 In Stock
  • $24.00 In Stock
  • Ebooks are DRM free.

  • Ebook delivery options.

About this Title

Pages: 222
Published: 2014-01-08
Release: P1.0 (2014-01-08)
ISBN: 978-1-93778-577-2

Grails is a full-stack web development framework that enables you to build complete web applications in a fraction of the time and with less code than other frameworks. Grails uses the principle of convention over configuration and the dynamic Groovy programming language.

This revised and updated new edition shows you how to use Grails by iteratively building a unique, working application. By the time you’re done, you’ll have built and deployed a real, functioning website. Using this hands-on, pragmatic approach, you’ll explore topics such as Ajax in Grails, custom tags, and plugins. You’ll dig into Grails’ powerful view technology, Groovy Server Pages, and see how you can easily leverage the help offered by scaffolding to create custom user interfaces faster than you would have thought possible. Along the way, you’ll learn about domain classes, controllers, and GSP views. And you’ll see how Grails enables you to use powerful frameworks such as Spring and Hibernate.

With Grails, you can get a lot done with little effort. With this book, you’ll get a lot done as well. Get started with Grails today.

Read the reviews .

What You Need

Grails 2 will run on any machine that supports Java. Grails applications can be deployed on any Java Servlet container, including Tomcat, Jetty, WebLogic, JBoss, and Websphere.

User Level

This book is for web developers who have done some Java web development.

Contents & Extracts

Greetings and Salutations!
  • Let Me Tell You About Grails…
  • How Does Grails Do It?
  • Why This Book?
  • Who Should Read This Book
  • Source Code
  • Acknowledgments
  • Enough Groovy to Be Dangerous
    • Groovy Syntax Compared to Java
    • Groovy Strings
    • Groovy Closures
    • Groovy Collections
    • Metaprogramming
    • Where to from Here?
  • Our Project
    • Introducing
    • Meet Our Customer
    • Iteration Zero
    • Summary
  • Laying the Foundation
    • Creating a Domain Class
    • More About Domain Classes
    • Testing Our Domain Class
    • Taking Control of Our Domain
    • Modifying Code That Doesn’t Exist
    • Bootstrapping Some Test Data
    • Summary
  • Building Relationships
    • The TekUser Domain Class
    • One-to-One Relationships
    • One-to-Many Relationships
    • Collections of Simple Data Types
    • Adding a Sponsor Class
    • Many-to-Many Relationships
    • Finishing Up the Domain Model
    • Summary
  • Beyond Scaffolding
    • Generating Scaffolding Code
    • Anatomy of a Grails Controller
    • Grails Views with Groovy Server Pages
    • Configuring a Database
    • Summary
  • Getting Things Done excerpt
    • Changing All Our Views at Once
    • Modifying the Scaffolded Views
    • Event Task List
    • Grails Service Classes
    • Integration Testing
    • Modifying the Task Class
    • Summary
  • Forum Messages and UI Tricks
    • Restricting Messages to an Event
    • Of Templates and Ajax
    • Display Message Threads with a Custom Tag
    • Summary
  • Knock, Knock: Who’s There? Grails Security excerpt
    • Grails Security Options
    • Logging In
    • Filters
    • Logging Out
    • Summary
  • Big-Picture Views
    • Home Page Makeover
    • Creating a New Controller
    • Designing the Dashboard View
    • Adding the Dashboard Action
    • Adding a Menu
    • Linking to the Dashboard
    • Summary
  • Seek, and You Shall Find
    • Search Using Dynamic Finders
    • Hibernate Criteria Builder
    • The Big Guns: The Searchable Plugin
    • Summary
  • Icing on the Cake
    • The jQuery UI Plugin
    • The Twitter4J Plugin
    • User-Friendly URLs
    • Summary
  • Deployment and Beyond
    • Using a JNDI Data Source
    • Creating and Deploying a WAR
    • Next Steps
    • Parting Thoughts
  • Additional CSS Rules
  • Resources
    • Online Resources
    • Meet the GR8 Community
    • Other Resources
    • IDE Support


Dave Klein is a consultant helping organizations of all sizes to develop applications more quickly with Grails—and have more fun doing it. Dave has worked as a developer, architect, project manager, mentor, and trainer for the past 18 years, and has presented at user groups and national conferences. Dave’s Groovy and Grails-related thoughts can be found at

Ben Klein began his Grails career in 2008 and is now a developer at Silver Chalice, where he works on Grails projects for clients large and small. He collects Groovy-related books, has written for GroovyMag, and is the author of Rizzo, the Groovy static site generator.