Grails in Action
Glen Smith and Peter Ledbrook
Foreword by Dierk König
  • May 2009
  • ISBN 9781933988931
  • 520 pages
  • printed in black & white

...rock-solid solutions delivered with ease.

Dierk König


Grails in Action, Second Edition is now available. An eBook of this older edition is included at no additional cost when you buy the revised edition!

Grails in Action is a comprehensive guide to the Grails framework. First, the basics: the domain model, controllers, views, and services. Then, the fun! Dive into a Twitter-style app with features like AJAX/JSON, animation, search, wizards—even messaging and Jabber integration. Along the way, you'll discover loads of great plugins that'll make your app shine. Learn to integrate with existing Java systems using Spring and Hibernate.

Table of Contents detailed table of contents




about this book

about the title

about the cover illustration

Part 1 Introducing Grails

1. Chapter 1 Grails in a hurry…​

1.1. Why Grails?

1.2. Getting set up

1.3. Our sample program: a Web 2.0 QOTD

1.4. Creating the domain model

1.5. Adding UI actions

1.6. Improving the architecture

1.7. Summary and best practices

2. Chapter 2 The Groovy essentials

2.1. An introduction

2.2. Exploring types

2.3. Time-saving features

2.4. Expert Groovy

2.5. Summary and best practices

Part 2 Core Grails

3. Chapter 3 Modeling the domain

3.1. Hubbub: starting our example application

3.2. Your first domain class object

3.3. Validation: stopping garbage in and out

3.4. Defining the data model—1:1, 1:m, m:n

3.5. Summary and best practices

4. Chapter 4 Putting the model to work

4.1. Creating instant UIs with scaffolding

4.2. Groovy querying with dynamic finders and Query by Example

4.3. More sophisticated query options

4.4. Bootstrapping reference data

4.5. Summary and best practices

5. Chapter 5 Controlling application flow

5.1. Controller essentials

5.2. Services: making things robust and maintainable

5.3. Data binding

5.4. Command objects

5.5. Working with images

5.6. Intercepting requests with filters

5.7. Creating custom URL mappings

5.8. Summary and best practices

6. Chapter 6 Developing tasty views, forms, and layouts

6.1. Understanding the core form tags

6.2. Extending views with your own tags

6.3. Adding delicious layouts

6.4. Applying Ajax tags

6.5. Summary and best practices

7. Chapter 7 Building reliable applications

7.1. Why should we test software?

7.2. Unit testing

7.3. Integration testing

7.4. Functional testing

7.5. Summary and best practices

Part 3 Everyday Grails

8. Chapter 8 Using plugins: adding Web 2.0 in 60 minutes

8.1. Taking advantage of others’ hard work

8.2. Adding charts and graphs

8.3. Adding mail support

8.5. GrailsUI makeover

8.6. Summary and best practices

9. Chapter 9 Wizards and workflow with webflows

9.1. What is a webflow?

9.2. Working with webflows

9.3. Advanced webflows

9.4. Testing webflows

9.5. Summary and best practices

10. Chapter 10 Don’t let strangers in—security

10.1. Why security matters

10.2. Protecting against malicious intent

10.3. Access control

10.4. Further exploration of Spring Security

10.5. Summary and best practices

11. Chapter 11 Remote access

11.1. Using a RESTful solution

11.2. Negotiating the representation

11.3. REST in practice

11.4. Operation-oriented remoting

11.5. Summary and best practices

12. Chapter 12 Understanding messaging and scheduling

12.1. A hitchhiker’s guide to messaging

12.2. Using the Grails JMS plugin

12.3. Grails scheduling

12.4. Advanced scheduling

12.5. Summary and best practices

Part 4 Advanced Grails

13. Chapter 13 Advanced GORM kung fu

13.1. Domain model kung fu

13.2. Caching kung fu: moving from 2 users to 2^10

13.3. Legacy integration kung fu: dealing with multiple data sources

13.4. Dealing with difficult legacy databases

13.5. Summary and best practices

14. Chapter 14 Spring and transactions

14.1. Spring and Grails

14.2. Using transactions with GORM

14.3. Summary and best practices

15. Chapter 15 Beyond compile, test, and run

15.1. The Grails build system

15.2. Build integration—not for the hobbyist

15.3. Coping with a changing data model

15.4. Summary and best practices

16. Chapter 16 Plugin development

16.1. Creating your first plugin

16.2. Publishing your plugin

16.3. Integrating with Grails

16.4. Summary and best practices


© 2014 Manning Publications Co.

About the Technology

Web apps shouldn't be hard to build, right? The developers of Grails agree. This hyper-productive open-source web framework lets you "code by convention", leaving you to focus on what makes your app special. Through its use of Groovy, it gives you a powerful, Java-like language and full access to all Java libraries. And you can adapt your app's behavior at runtime without a server restart.

What's inside

  • A concise Groovy primer
  • Advanced UI development
  • Enterprise integration
  • Plugin development
  • Tips and tricks from the trenches

About the reader

You'll need basic familiarity with Java and the web. Prior experience with Groovy is not necessary.

About the authors

A frequent speaker and the co-host of the Grails podcast, Glen Smith launched the first public-facing Grails app (an SMS Gateway) on Grails 0.2. Peter Ledbrook is a core Grails developer and author of several popular plugins, who has worked as an engineer for both G2One and SpringSource.

Bulging with serious content and tips. Bursting with fun.

Paul King, ASERT

Excellent resource, both as a guide and a reference.

John Guthrie, Sybase

Grails is the PHP of Web 2.0 and this book is pure gold.

John G. Ledo, Ledo Works Inc. approachable and entertaining book...sure to simplify your Grails development.

Joe McTee, JEKI.soft

Great framework + Great authors = Awesome book!

Dave Klein, Contegix

Read this book if you want to raise your Grails IQ by 100+ points!

Zan Thrash, Thrash Consulting