About this Book

Grails in Action is a comprehensive introduction to the Grails framework covering the nuts and bolts of all core Grails components: controllers, views, services, webflows, taglibs, Ajax, and plugins. But much more than an introduction, Grails in Action is jam-packed with skills, techniques, and insights from the trenches: solving the challenges you’re likely to face developing your next killer web app.

Roadmap

Grails in Action gives you a fast-paced and accessible introduction to the world of agile web development.

The book is divided into four parts:

Part 1 will introduce you to Grails by taking you through building your first Grails application—a simple Quote of the Day application. You’ll get a taste for all the parts of the Grails ecosystem and for how all the parts hang together to create a complete application. But in order to make any sophisticated use of Grails, you’ll need an appreciation for Groovy—the dynamic language that forms the foundation of your Grails coding. So we’ll spend some time training you on all the basics.

Part 2 begins our deeper exploration of the core Grails artifacts. You’ll learn how models, views, and controllers interact, and you’ll gain a deep understanding of all the core features that make up the heart of Grails applications. We’ll introduce you to Hubbub, our sample social-networking application, and implement all the features that you’ll commonly find in Grails applications: domain modeling, querying, skins and layout, form handling, and more. By the end of part 2, you’ll be confidently developing your own basic applications.

Because real-world web applications involve a lot more than just forms and databases, part 3 will tackle the skills you’ll need to take your application to the world. We’ll explore testing strategies to ensure your code is implemented correctly, and we’ll show how to give your application that Web 2.0 feel through time-saving third-party plugins. No application is very useful without some kind of security model, so we’ll explore the security implications of taking your Grails application online. Finally, we’ll look at remoting strategies for designing RESTful APIs and conclude with a survey of the asynchronous technologies that are becoming increasingly popular in developing scalable applications.

In part 4, we conclude our tour of Grails with the most advanced features of the framework. We’ll look at how you can tune your data access for maximum performance and integrate with legacy databases, and we’ll look deep inside Grails’ underlying technologies, Spring and Hibernate. We’ll also show you how to integrate Grails with your existing build processes. Finally, we’ll end with a deep discussion of writing and publishing your own Grails plugins.

Who should read this book

Whether you’re a seasoned Java developer ready to dip your toes in the waters of dynamic web frameworks, or a hardcore web developer making the switch to the latest Convention over Configuration paradigm, Grails in Action will give you the tools to get productive quickly and the deep knowledge to handle the corner cases when you get stuck.

Some experience with web development (in particular CSS, HTML, and JavaScript) is assumed, along with a basic knowledge of programming. Previous experience with Java web development is an advantage, but we take the time to explain core Java web concepts in sidebars where applicable. If you’re coming from another language background (such as Ruby, Perl, or PHP), you should find the move to Grails quite natural.

Code conventions

This book provides copious examples that show how you can make use of each of the topics covered. Source code in listings or in text appears in a fixed-width font like this to separate it from ordinary text. In addition, class and method names, object properties, and other code-related terms and content in text are presented using the same fixed-width font.

Code and command-line input can be verbose. In many cases, the original source code (available online) has been reformatted; we’ve added line breaks and reworked indentation to accommodate the page space available in the book. In rare cases, when even this was not enough, line-continuation markers were added to show where longer lines had to be broken.

Code annotations accompany many of the listings, highlighting important concepts. In some cases, numbered cueballs link to additional explanations that follow the listing.

Getting the source code

You can access the source code for all of the examples in the book from the publisher’s website at www.manning.com/GrailsinAction. All source code for the project is hosted at GitHub (github.com)—a commercial Git hosting firm. We will maintain the current URL via the publisher’s website. The source is maintained by chapter, so, for example, you can download /source-code/ch06 and you will have a full copy of the source up to that point in the book.

Keeping up to date

The Grails world moves very quickly. There have been substantial changes in Grails in the year it took us to develop Grails in Action. Moving from Grails 1.0 to 1.1 caused numerous new sections to be written, and existing sections to be rewritten to take advantage of new features!

Although we developed the book targeting Grails 1.1, a subsequent Grails version may well have been released by the time you read this. New Grails versions bring new functionality, but Grails rarely introduces serious breaking changes, so all the knowledge you learn here will put you in great stead for future releases.

If there are portions of source code needing modification for a future release, you’ll be able to find information on the Grails in Action Author Online forum (www.manning.com/GrailsinAction).

Author Online

Purchase of Grails in Action includes free access to a private web forum run by Manning Publications where you can make comments about the book, ask technical questions, and receive help from the authors and from other users. To access the forum and subscribe to it, point your web browser to www.manning.com/GrailsinAction. This page provides information on how to get on the forum once you are registered, what kind of help is available, and the rules of conduct on the forum. It also provides links to the source code for the examples in the book, errata, and other downloads.

Manning’s commitment to our readers is to provide a venue where a meaningful dialog between individual readers and between readers and the authors can take place. It is not a commitment to any specific amount of participation on the part of the authors, whose contribution to the Author Online remains voluntary (and unpaid). We suggest you try asking the authors some challenging questions lest their interest stray!

The Author Online forum and the archives of previous discussions will be accessible from the publisher’s website as long as the book is in print.

about the authors

GLEN SMITH started “stunt programming” the day his school took delivery of its first set of Hitachi Peach computers (in the early ’80s) and has been doing it ever since. He’s worked as a Unix/C systems programmer, Perl hacker, and even Visual Basic dude (but he tells everyone it was just a phase). When Java came along, he lost interest in everything else. These days, he spends most of his time consulting in Java EE technologies to the Australian government.

He has been involved in the Grails community since Grails 0.1 and launched the first public-facing Grails app (an SMS gateway) on Grails 0.2. He is a regular on the Groovy and Grails speaking circuit, the cohost of the Grails podcast (http://grailspodcast.com), and the man behind groovyblogs.org.

Glen lives in Canberra, Australia, with his wife, two children, three chickens, and one dachshund. He blogs at http://blogs.bytecode.com.au/glen and twitters at http://twitter.com/glen_a_smith.

PETER LEDBROOK started his software development career as a teenager learning to program in the comfort of his bedroom. After surviving the trials and tribulations of C and C++, he switched to Java during his first job and has stayed with it ever since.

An avid fan of open source software since those early days, he has always looked to that community for innovative and useful solutions. He discovered Grails while investigating Ruby on Rails and was astonished at how easy it was to write web applications using the framework. The love affair began.

He wrote several popular plugins (Remoting, JSecurity, and GWT) and then became a core Grails committer when he joined G2One as a consultant at the end of 2007. He also has plenty of battle scars from actively working on several public-facing applications and helping teams make the most of Grails.

about the technical editor

BURT BECKWITH is an enterprise Java and Grails developer with over 10 years of experience in a variety of industries including biotech, travel, e-learning, social networking, and financial services. He worked briefly with Groovy when it was first released, but it wasn’t until he discovered Grails that the combination clicked for him, and he has no intention of looking back. He has a blog at http://burtbeckwith.com/blog/, and you can follow him on Twitter at http://twitter.com/burtbeckwith.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset