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.

Buy Now

Select a DRM-free Format:

In Stock
In Stock
In Stock
Buy the eBook and get these DRM-free formats delivered immediately:
  • epub (for iPhone/iPad, Android, eReaders)
  • mobi (for Kindle)
  • PDF
We can automatically send them to your Kindle, and your Dropbox. (You'll need to log in to enable these options.)
 

About this Book

  • 222 pages
  • Published:
  • 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.

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 and 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 TekDays.com
    • 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

About the Author

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 dave-klein.blogspot.com.

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.

Comments and Reviews

  • This book is a delight: a warm, smart introduction to the Grails framework, illustrated by a friendly mentor over several iterations on a small project. It’s pair-programming on the page. By the end of the ride, we’ve created an impressive app, and we’re ready for deeper dives, with a wealth of resources provided. Fabulous!

    —Michael Easter Software composer codetojoy.blogspot.com
  • If you are looking for a book to take you from Java to productivity with Grails as quickly as possible, this is your book. Dave has produced a fantastic and pragmatic iterative guide to building a full Grails application, including advice for development and production. This book is the quickest way to accelerate your learning of Grails.

    —Ken Sipe Code Mentor, Inc.
  • Dave and Ben have done it again. Grails 2: A Quick Start Guide is the best book you could hand to a new Grails developer. It’s a great mix of instruction and practice and just what you need to get started, or get better, with Grails.

    —Jared Richardson Agile coach Agile Artisans

Latest Topics in the Forums…

Join the Discussion