Table of Contents

1. Introduction
2. Getting Started
2.1 Downloading and Installing
2.2 Upgrading from Grails 1.0.x
2.3 Creating an Application
2.4 A Hello World Example
2.5 Getting Set-up in an IDE
2.6 Convention over Configuration
2.7 Running an Application
2.8 Testing an Application
2.9 Deploying an Application
2.10 Creating Artefacts
2.10 Supported Java EE Containers
2.11 Generating an Application
3. Configuration
3.1 Basic Configuration
3.1.1 Built in options
3.1.2 Logging
3.2 Environments
3.3 The DataSource
3.3.1 DataSources and Environments
3.3.2 JNDI DataSources
3.3.3 Automatic Database Migration
3.4 Externalized Configuration
3.5 Versioning
4. The Command Line
4.1 Creating Gant Scripts
4.2 Re-using Grails scripts
4.3 Hooking into Events
4.4 Customising the build
4.5 Ant and Maven
5. Object Relational Mapping (GORM)
5.1 Quick Start Guide
5.1.1 Basic CRUD
5.2 Domain Modelling in GORM
5.2.1 Association in GORM
5.2.1.1 One-to-one
5.2.1.2 One-to-many
5.2.1.3 Many-to-many
5.2.1.4 Basic Collection Types
5.2.2 Composition in GORM
5.2.3 Inheritance in GORM
5.2.4 Sets, Lists and Maps
5.3 Persistence Basics
5.3.1 Saving and Updating
5.3.2 Deleting Objects
5.3.3 Understanding Cascading Updates and Deletes
5.3.4 Eager and Lazy Fetching
5.3.5 Pessimistic and Optimistic Locking
5.4 Querying with GORM
5.4.1 Dynamic Finders
5.4.2 Criteria
5.4.3 Hibernate Query Language (HQL)
5.5 Advanced GORM Features
5.5.1 Events and Auto Timestamping
5.5.2 Custom ORM Mapping
5.5.2.1 Table and Column Names
5.5.2.2 Caching Strategy
5.5.2.3 Inheritance Strategies
5.5.2.4 Custom Database Identity
5.5.2.5 Composite Primary Keys
5.5.2.6 Database Indices
5.5.2.7 Optimistic Locking and Versioning
5.5.2.8 Eager and Lazy Fetching
5.5.2.9 Custom Cascade Behaviour
5.5.2.10 Custom Hibernate Types
5.5.3 Default Sort Order
5.6 Programmatic Transactions
5.7 GORM and Constraints
6. The Web Layer
6.1 Controllers
6.1.1 Understanding Controllers and Actions
6.1.2 Controllers and Scopes
6.1.3 Models and Views
6.1.4 Redirects and Chaining
6.1.5 Controller Interceptors
6.1.6 Data Binding
6.1.7 XML and JSON Responses
6.1.8 Uploading Files
6.1.9 Command Objects
6.1.10 Handling Duplicate Form Submissions
6.2 Groovy Server Pages
6.2.1 GSP Basics
6.2.1.1 Variables and Scopes
6.2.1.2 Logic and Iteration
6.2.1.3 Page Directives
6.2.1.4 Expressions
6.2.2 GSP Tags
6.2.2.1 Variables and Scopes
6.2.2.2 Logic and Iteration
6.2.2.3 Search and Filtering
6.2.2.4 Links and Resources
6.2.2.5 Forms and Fields
6.2.2.6 Tags as Method Calls
6.2.3 Views and Templates
6.2.4 Layouts with Sitemesh
6.2.5 Sitemesh Content Blocks
6.3 Tag Libraries
6.3.1 Variables and Scopes
6.3.2 Simple Tags
6.3.3 Logical Tags
6.3.4 Iterative Tags
6.3.5 Tag Namespaces
6.3.6 Using JSP Tag Libraries
6.4 URL Mappings
6.4.1 Mapping to Controllers and Actions
6.4.2 Embedded Variables
6.4.3 Mapping to Views
6.4.4 Mapping to Response Codes
6.4.5 Mapping to HTTP methods
6.4.6 Mapping Wildcards
6.4.7 Automatic Link Re-Writing
6.4.8 Applying Constraints
6.5 Web Flow
6.5.1 Start and End States
6.5.2 Action States and View States
6.5.3 Flow Execution Events
6.5.4 Flow Scopes
6.5.5 Data Binding and Validation
6.5.6 Subflows and Conversations
6.6 Filters
6.6.1 Applying Filters
6.6.2 Filter Types
6.6.3 Variables and Scopes
6.7 Ajax
6.7.1 Ajax using Prototype
6.7.1.1 Remoting Linking
6.7.1.2 Updating Content
6.7.1.3 Remote Form Submission
6.7.1.4 Ajax Events
6.7.2 Ajax with Dojo
6.7.3 Ajax with GWT
6.7.4 Ajax on the Server
6.8 Content Negotiation
7. Validation
7.1 Declaring Constraints
7.2 Validating Constraints
7.3 Validation on the Client
7.4 Validation and Internationalization
7.5 Validation Non Domain and Command Object Classes
8. The Service Layer
8.1 Declarative Transactions
8.2 Scoped Services
8.3 Dependency Injection and Services
8.4 Using Services from Java
9. Testing
9.1 Unit Testing
9.2 Integration Testing
9.3 Functional Testing
10. Internationalization
10.1 Understanding Message Bundles
10.2 Changing Locales
10.3 Reading Messages
10.4 Scaffolding and i18n
11. Security
11.1 Securing Against Attacks
11.2 Encoding and Decoding Objects
11.3 Authentication
11.4 Security Plug-ins
11.4.1 Acegi
11.4.2 JSecurity
12. Plug-ins
12.1 Creating and Installing Plug-ins
12.2 Plugin Repositories
12.3 Understanding a Plug-ins Structure
12.4 Providing Basic Artefacts
12.5 Evaluating Conventions
12.6 Hooking into Build Events
12.7 Hooking into Runtime Configuration
12.8 Adding Dynamic Methods at Runtime
12.9 Participating in Auto Reload Events
12.10 Understanding Plug-in Load Order
13. Web Services
13.1 REST
13.2 SOAP
13.3 RSS and Atom
14. Grails and Spring
14.1 The Underpinnings of Grails
14.2 Configuring Additional Beans
14.3 Runtime Spring with the Beans DSL
14.4 The BeanBuilder DSL Explained
14.5 Property Placeholder Configuration
14.6 Property Override Configuration
15. Grails and Hibernate
15.1 Mapping with Hibernate Annotations
15.2 Further Reading
16. Scaffolding
17. Deployment