The Definitive Guide to Grails 2

Book description

Grails is a full stack framework which aims to greatly simplify the task of building serious web applications for the JVM. The concepts within Grails, like interceptors, tag libs, and Groovy Server Pages (GSP), make those in the Java community feel right at home.

Grails' foundation is on solid open source technologies such as Spring, Hibernate, and SiteMesh, which gives it even more potential in the Java space: Spring provides powerful inversion of control and MVC, Hibernate brings a stable, mature object relational mapping technology with the ability to integrate with legacy systems, and SiteMesh handles flexible layout control and page decoration.

Grails complements these with additional features that take advantage of the coding–by–convention paradigm such as dynamic tag libraries, Grails object relational mapping, Groovy Server Pages, and scaffolding.

Graeme Rocher, Grails lead and founder, and Jeff Brown bring you completely up–to–date with their authoritative and fully comprehensive guide to the Grails 2 framework. You'll get to know all the core features, services, and Grails extensions via plug–ins, and understand the roles that Groovy and Grails are playing in the changing Web.

What you'll learn

  • Discover how the Web is changing and the role the Groovy language and its Grails framework play

  • Get to know the Grails Project and its domains, services, filters, controllers, views, testing, and plug–ins

  • Experience the availability of plug–ins for Rich Client and Ajax, web services, performance/utilities, scheduling, security, functionality, and even Persistence

  • See how Grails works with other frameworks like Spring, Wicket, Hibernate, and more

  • Create custom plug–ins in Grails

  • Who this book is for

    This book is for everyone who is looking for a more agile approach to web development with a dynamic scripting language such as Groovy. This includes a large number of Java developers who have been enticed by the productivity gains seen with frameworks such as Ruby on Rails, JRuby on Rails, etc. The Web and its environment is a perfect fit for easily adaptable and concise languages such as Groovy and Ruby, and there is huge interest from the developer community in general to embrace these languages.

    Table of contents

    1. Title
    2. Dedication
    3. Contents at a Glance
    4. Contents
    5. About the Author
    6. About the Technical Reviewer
    7. Acknowledgments
    8. Chapter 1: The Essence of Grails
      1. Simplicity and Power
      2. Grails, the Platform
      3. Living in the Java Ecosystem
      4. Installing and Configuring Grails
      5. Creating Your First Application
      6. Grails Interactive Mode
      7. Summary
    9. Chapter 2: Getting Started with Grails
      1. What Is Scaffolding?
      2. Creating a Domain
      3. Introducing Dynamic Scaffolding
      4. Static Scaffolding
      5. Being Environmentally Friendly
      6. Configuring Data Sources
      7. Deploying the Application
      8. Summary
    10. Chapter 3: Understanding Domain Classes
      1. Persisting Fields to the Database
      2. Validating Domain Classes
      3. Using Custom Validators
      4. Understanding Transient Properties
      5. Customizing Your Database Mapping
      6. Building Relationships
      7. Extending Classes with Inheritance
      8. Embedding Objects
      9. Testing Domain Classes
      10. Summary
    11. Chapter 4: Understanding Controllers
      1. Defining Controllers
      2. Creating a Model
      3. Rendering a View
      4. Performing Data Binding
      5. Working with Command Objects
      6. Imposing HTTP Method Restrictions
      7. Controller IO
      8. Using Simple Interceptors
      9. Testing Controllers
      10. Controllers in Action
      11. Summary
    12. Chapter 5: Understanding Views
      1. The Basics
      2. Built-in Grails Tags
      3. Grails Dynamic Tags
      4. Summary
    13. Chapter 6: Mapping URLs
      1. Understanding the Default URL Mapping
      2. Including Static Text in a URL Mapping
      3. Removing the Controller and Action Names from the URL
      4. Embedding Parameters in a Mapping
      5. Specifying Additional Parameters
      6. Mapping to a View
      7. Applying Constraints to URL Mappings
      8. Mapping to HTTP Request Methods
      9. Mapping HTTP Response Codes
      10. Taking Advantage of Reverse URL Mapping
      11. Named URL Mappings
      12. Defining Multiple URL Mappings Classes
      13. Testing URL Mappings
      14. Summary
    14. Chapter 7: Internationalization
      1. Localizing Messages
      2. Using Parameterized Messages
      3. Using Parameterized Messages for Validation
      4. Using messageSource
      5. Summary
    15. Chapter 8: Ajax
      1. Writing Ajax Code
      2. Ajax in Action
      3. Changing Your Ajax Provider
      4. Asynchronous Form Submission
      5. Fun with Ajax Remote Linking
      6. Adding Effects and Animation
      7. Ajax-Enabled Form Fields
      8. A Note on Ajax and Performance
      9. Summary
    16. Chapter 9: GORM
      1. Persistence Basics
      2. Associations
      3. Querying
      4. Configuring GORM
      5. The Semantics of GORM
      6. Transactions in GORM
      7. Detached Objects
      8. Performance Tuning GORM
      9. Locking Strategies
      10. Events Auto Time Stamping
      11. Summary
    17. Chapter 10: Services
      1. Understanding Service Basics
      2. Services and Dependency Injection
      3. Services in Action
      4. Managing Transactions
      5. Scoping Services
      6. Testing Services
      7. Exposing Services
      8. Summary
    18. Chapter 11: Integration and Dependency Management
      1. Grails and Configuration
      2. Declaring Dependencies
      3. Understanding the Grails Build System
      4. Continuous Integration with Hudson
      5. Adding Support to Your Favorite IDE
      6. Integration with E-mail Servers
      7. Deployment
      8. Summary
    19. Chapter 12: Plug-ins
      1. Plug-in Basics
      2. Plug-ins in Action
      3. Specifying Plug-in Locations on the File System
      4. Using the Resources Plug-in
      5. Using the Database Migration Plug-in
      6. Summary
    20. Index

    Product information

    • Title: The Definitive Guide to Grails 2
    • Author(s):
    • Release date: January 2013
    • Publisher(s): Apress
    • ISBN: 9781430243779