(non-printable free online version)
If you like the book, please support the author and InfoQ by
purchasing the printed book:
http://www.lulu.com/content/618462 (only $19.95) Brought to you Courtesy of
This book is distributed for free on InfoQ.com, if you have received this book from any other source then please support the author and the publisher by registeringon InfoQ.com.
Visit the homepage for this book at:
Getting Started with Grails
Written by: Jason Rudolph
© 2006 C4Media Inc All rights reserved. C4Media, Publisher of InfoQ.com. This book is part of the InfoQ Enterprise Software Development series of books. For information or ordering of this or other InfoQ books, please contact email@example.com.No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recoding, scanning or otherwise except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher. Designations used by companies to distinguish their productsare often claimed as trademarks. In all instances where C4Media Inc. is aware of a claim, the product names appear in initial Capital or ALL CAPITAL LETTERS. Readers, however, should contact the appropriate companies for more complete information regarding trademarks and registration. Managing Editor: Floyd Marinescu Cover art: Gene Steffanson Composition: Laura Brown Library of CongressCataloguing-in-Publication Data: ISBN: 978-1-4303-0782-2 Printed in the United States of America
I would like to thank Graeme Rocher (Grails project lead and author of The Definitive Guide to Grails) for reviewing this book and for enlightening me to the inner workings of Grails along the way. Your detailed review provided invaluable technical insight and excellent recommendations for incorporating“Groovier” solutions into the examples.
I would also like to thank Venkat Subramaniam (co-author of Practices of an Agile Developer) for reviewing this book with a keen emphasis on the learning experience and how to best introduce Grails to the reader. In addition to that contribution, your insightful foreword welcomes developers to a framework that will surely foster agility andits many benefits. I’d like to thank Steve Rollins for diligently pouring through this book to uncover any lingering issues, even though it meant a few weeks of being a nerd outside of normal working hours. Your tireless attention to detail is clearly reflected in the final product. I would also like to thank Jared Richardson (co-author of Ship it! A Practical Guide to Successful SoftwareProjects) not only for reviewing this book, but for motivating me to write it in the first place. Your encouragement throughout the process and your valuable perspective on the end result are greatly appreciated. I would like to thank Floyd Marinescu (co-founder of InfoQ.com and author of EJB Design Patterns) and the entire team at InfoQ for publishing this book and for your enthusiastic supportthroughout the effort.
Most importantly, I’d like to thank my unflinchingly patient and encouraging wife Michelle for supporting me throughout this effort. It was only by your willingness to do far more than your fair share (of just about everything) that I was able to have time for this project. And as if it wasn’t enough just to provide the support to make this book possible, your creativity,sense of style, and editorial input contributed to make this book better than it would have been on its own.
1. INTRODUCTION Learning by Example The RaceTrack Application 2. LACING UP Installing a JDK Installing Grails Installing a Database 3. HELLO, GRAILS! Creating Your First Grails Application What’s Inside? Establishing Your Domain Taking Control Where’s My Data?...