Sei sulla pagina 1di 15

An Introduction

to developing
web application
using Grails

Donny Airlangga
Software Developer DXN Solutions
Goals of this training

Learning how to develop web application


Using
Web application framework Grails
What is Grails ?

Full stack of MVC ( Model View


Controller) Framework for Web
Application
Inspired by Ruby On Rails
Exploits the awesome power of
Groovy
MVC (Model View
Controller)
A design pattern used in services
architectures. Contains 3 distinct elements :
The 'Model' is how the underlying data is
structured.
The 'View' is what is presented to the user
or consumer.
The 'Controller' is the element that
performs the processing.
Groovy
is an agile and dynamic language for the
Java Virtual Machine
makes modern programming features
available to Java developers with almost-
zero learning curve
seamlessly integrates with all existing Java
objects and libraries
Increases developer productivity by
reducing scaffolding code when developing
web, GUI, database or console applications
Getting Started
Installation
Download and unzip grails.zip from the Grails
site: Grails.org
Set GRAILS_HOME environment variables
Add to $GRAILS_HOME/bin to the path
Getting Started
Create an application “MyProject”
Run “grails create-app MyProject”
Edit the DataSource.grovy (optional)
Run “grails create-domain-class People”
Edit people.grovy
Run “grails generate-all”
Run “grails run-http”
Grails command
create-app generate-controller
create-controller generate-views
create-service generate-all
create-domain-class run-app
help war
Domain Classes
The “Model”
Stick to the rules :
Let the controller do the controlling
Let the view do the viewing
May define validation constraints
Views
The Views
Groovy Server Pages (GSP)
Custom tag libraries
Controller
The controller
The traffic cop
Defining the action
Navigating the view
Scaffolding

Dynamic and generated code


The generated code easy to learn
Demo
Resources
If you want to learn more, go to
http://www.grails.org/Tutorials
Screencast : http://www.grails.org/Grails+Screencasts
http://www.ibm.com/developerworks/views/java/libraryview.js
End

Thank you

Potrebbero piacerti anche