Book Image

Grails 1.1 Web Application Development

By : Jon Dickinson
Book Image

Grails 1.1 Web Application Development

By: Jon Dickinson

Overview of this book

Web development is trickyóeven a simple web application has a number of context changes ready to trip up the unwary. Grails takes the everyday pain out of web application development, allowing us to focus on delivering real application logic and create seamless experiences that will address the needs of our users. This book will take the pain out of Grails by showing you exactly how to build a web application with a minimum of fuss. With this book, even if you are new to Grails, you will be up and running before you know it. You will be able to code faster and your code will be better. This clear and concise book is packed with examples and clear instructions to help you build your first Grails application and gives you the skills to speed up your application development by adding a different angle for learning about the topic. After a brief introduction to the dynamic JVM-based Groovy programming language, which teaches you enough about Groovy to understand the relationship between Grails and the Groovy scripting language, it shows how to use Grails and a number of key plug-ins to deliver valuable web applications. It also takes you through creating, developing, testing, and deploying an example team collaboration application in Grails. Using an incremental and iterative approach you will learn how to build a basic web application with secure authentication and different levels of authorization. You will learn how to handle file upload allowing users to share files. Some advanced features of object-oriented persistence will be introduced through adding tags for messages and files to giving users a robust categorization system. You will then build on the basic application to enhance the user experience through AJAX and the RichUI plug-in. You will take a further step into the world of Web 2.0 by adding an RSS feed and a REST service to the application. Once the entire application is up and running, you will learn how to create your own plug-in for tagging. Finally, you will learn how to deploy this application to a production environment.
Table of Contents (20 chapters)
Grails 1.1 Web Application Development
Credits
About the author
Acknowledgement
About the reviewers
Preface

Groovy features


You will now embark on a whirlwind tour of some of the language features provided by Groovy. The aim is to give you enough background to continue development of the application.

Semicolons

In Java, the semicolon is used to determine the end of a statement. In Groovy, the use of the semicolon is optional.

def knightsSay = 'Ni'
def rabbitsTeeth = 'Fangs';
def name = 'Lancelot'; def favoriteColour = 'blue'
assert knightsSay == 'Ni'
assert rabbitsTeeth == 'Fangs'
assert name == 'Lancelot'
assert favoriteColour == 'blue'

We can see that the definition of the first variable does not use a semicolon to end the statement while the second variable definition does. The only real use of semicolons in Groovy is that you can put multiple execution lines of code on the same line in the code:

String first, second, third
first = 'one'; second = 'two'; third = 'three'
println first; println second; println third

Strings

Groovy provides five separate ways to define a String. The first is the basic...