The Definitive Guide to Grails, Second Edition

  • 9h 24m
  • Graeme Rocher, Jeff Brown
  • Apress
  • 2009

The rise of Ruby on Rails has signified a huge shift in how we build web applications today; it is a fantastic framework with a growing community. There is, however, space for another such framework that integrates seamlessly with Java. Thousands of companies have invested in Java, and these same companies are losing out on the benefits of a Rails–like framework. Enter Grails.

Grails is not just a Rails clone, it aims to provide a Rails–like environment that is more familiar to Java developers and that employs idioms that Java developers are comfortable using, making the adjustment in mentality to a dynamic framework less of a jump. 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 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 Rails framework plays.
  • 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 is this book 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.

About the Authors

GRAEME KEITH ROCHER is a software engineer and head of Grails development at SpringSource, the company behind the Spring Framework that underpins Grails. In his current role, Graeme leads the ongoing development of the Grails framework, driving product strategy and innovation for the Grails framework.

Graeme started his career in the e-learning sector as part of a team developing scalable enterprise learning management systems based on Java EE technology. He later branched into the digital TV arena, where he faced increasingly complex requirements that required an agile approach as the ever-changing and young digital TV platforms evolved. This is where Graeme was first exposed to Groovy and where he began combining Groovy with Cocoon to deliver dynamic multichannel content management systems targeted at digital TV platforms.

Seeing an increasing trend for web delivery of services and the complexity it brought, Graeme embarked on another project to simplify it and founded Grails. Grails is a framework with the essence of other dynamic language frameworks but is targeted at tight Java integration. Graeme is the current project lead of Grails and is a member of the Groovy JSR-241 executive committee.

Before SpringSource, Graeme cofounded G2One Inc.—The Groovy/Grails Company—along with Guillaume Laforge (Groovy project lead) and Alex Tkachman (former JetBrains COO). G2One provided consulting, training, and support for the Groovy and Grails technologies. In October 2008, SpringSource acquired G2One, and Graeme, along with his colleagues at G2One, joined the number-one provider of enterprise software in the Java space. SpringSource now provides training, support, consulting, and products for Groovy and Grails, as well as the frameworks that underpin them such as Spring and Hibernate.

JEFF BROWN is a software engineer at SpringSource and a member of the Groovy and Grails development teams. Jeff has been involved with software engineering since the early 1990s and has designed and built systems for industries including financial, biomedical, aerospace, and others.

Jeff began his software engineering career building business systems in C and C++ targeting the Unix, OS/2, and Windows platforms. As soon as the Java language came along, he realized that it was going to be a very important technology moving forward. At this point, Jeff joined Object Computing Inc. based in St. Louis, Missouri, where he spent the next 11 years building systems for the Java platform, coaching and mentoring developers, developing and delivering training, and evangelizing.

While fully appreciating the power and flexibility offered by the Java platform, Jeff was frustrated with the unnecessary complexity often associated with Java applications. In particular, web application development with Java seemed to have a ridiculous amount of complexity that really had nothing at all to do with the real problems solved by the application. Jeff discovered the Grails framework soon after Graeme founded the project. Here were the beginnings of a solution that made so much more sense in so many ways. After digging in to the source code of the project, Jeff began making contributions and eventually became a member of the Grails development team.

Jeff eventually joined the team at G2One Inc.—The Groovy/Grails Company—where he would help drive the professional services side of the business. In late 2008, Jeff joined Spring-Source when G2One and SpringSource came together to leverage synergies between the technologies created and supported by each company.

Through his entire career Jeff has always been a hands-on technologist actively involved in software development, training, and mentoring. He is also an international public speaker, having been featured regularly on the No Fluff Just Stuff Software Symposium tour for a number of years.

In this Book

  • The Essence of Grails
  • Getting Started with Grails
  • Understanding Domain Classes
  • Understanding Controllers
  • Understanding Views
  • Mapping URLs
  • Internationalization
  • Ajax
  • Creating Web Flows
  • GORM
  • Services
  • Integrating Grails
  • Plugins
  • Security
  • Web Services
  • Leveraging Spring
  • Legacy Integration with Hibernate