SlideShare a Scribd company logo
Grails
High-velocity development for Spring applications
About Me
David Jacobs
● Web Developer since '98

● Groovy since '06          Twitter
                            @MetaThis
● Grails focus in '08-'09
What is Grails?
Grails is an open-source framework for high-velocity
development of Spring applications
 ● Sensible defaults
 ● Convention-over-configuration
 ● DRY
 ● Dynamic metaprogramming
 ● End-to-end integrated stack
 ● Enables you to focus on the business problem
Best-of-Breed Java Technologies
●   Spring
●   Spring MVC
●   Hibernate
●   log4j
●   jUnit
●   SiteMesh

Recommended for you

Mobile Day - React Native
Mobile Day - React NativeMobile Day - React Native
Mobile Day - React Native

This document provides an overview of React Native, including what it is, how it works, and its features and capabilities. Some key points: - React Native allows building native mobile apps using JavaScript and React by rendering to real native UI components. It provides cross-platform development for iOS and Android. - Apps are built using familiar React components, props, state, lifecycle methods, etc. but render to native mobile UI elements instead of HTML. - It includes common mobile components like View, Text, Image, etc. and access to native device features and APIs. - Developers can create custom native iOS and Android modules and components to integrate with native code and libraries. - Tools like

javascriptmobile
Getting Started With ReactJS
Getting Started With ReactJSGetting Started With ReactJS
Getting Started With ReactJS

This document provides an overview of ReactJS including installing ReactJS, configuring ReactJS locally and via CDN, what JSX is, creating custom components with JSX, ReactJS event handling, lifecycle, stateful components, precompiling JSX, developing a digital clock, and debugging ReactJS. It also discusses the ReactJS initialization, lifetime, and teardown phases and provides an example of the component lifecycle.

Using React with Grails 3
Using React with Grails 3Using React with Grails 3
Using React with Grails 3

This document discusses using React with Grails 3. It begins with an overview of React, explaining key concepts like components, props, and state. It then covers different approaches to using React in Grails projects, including with the Asset Pipeline, Webpack, and the React profile for Grails which generates a project setup with React and Webpack configured. Isomorphic React, which allows server-side rendering with Nashorn, is also demonstrated. Resources for further learning about React, Grails plugins, and integrating the two frameworks are provided.

Integrated Stack
●   Layers and technologies integrated and wired
    out-of-the-box
●   Default configurations based on industry best
    practices
    ●   80/20 rule
Directory Structure
●   grails-app - top level directory for Groovy sources
     ●   conf - Configuration sources.
     ●   controller - Web controllers - The C in MVC.
     ●   domain - The application domain.
     ●   i18n - Support for internationalization (i18n).
     ●   services - The service layer.
     ●   taglib - Tag libraries.
     ●   views - Groovy Server Pages.
●   scripts - Gant/Gradle scripts.
●   src - Supporting sources
     ●   groovy - Other Groovy sources
     ●   java - Other Java sources
●   test - Unit and integration test
GORM
●   Object Relational Mapping (ORM)
●   Data access layer
●   Simplifies configuration through conventions
●   Defaults to Hibernate implementation
     ● Provided as plugin, alternatives pluggable
●   Extends and simplifies data access APIs
●   Similar to ActiveRecord in Rails
GORM
Domain Modeling
//this is a complete Hibernate mapping!
class Employee {
    String firstName
    String lastName
    Date startDate
}

Recommended for you

OSGi and Spring Data for simple (Web) Application Development - Christian Bar...
OSGi and Spring Data for simple (Web) Application Development - Christian Bar...OSGi and Spring Data for simple (Web) Application Development - Christian Bar...
OSGi and Spring Data for simple (Web) Application Development - Christian Bar...

This document discusses using OSGi and Spring Data to develop simple web applications. It describes using Bndtools for OSGi application development and the enRoute project for getting started with OSGi. It provides an overview of using JPA and Spring Data with OSGi for the persistence layer. It also covers integrating Handlebars templates, Jersey MVC, and AngularJS for the web layer. Testing strategies using Spock and integration tests are presented. The technologies discussed include OSGi, Equinox, Felix, JPA, Spring Data, Jersey, Handlebars, and AngularJS.

osgiosgi community event 2014eclipsecon europe
Angular beans
Angular beansAngular beans
Angular beans

This document introduces AngularBeans, which aims to integrate AngularJS with Java EE backends using CDI. Some key points: - AngularBeans allows defining Angular services using CDI beans, and enables features like dependency injection, JSON-RPC calls, and real-time capabilities between the frontend and backend. - It supports concepts of single-page applications and thin server architectures. AngularBeans services can make HTTP requests, handle events, and communicate over websockets. - Examples show how to create an AngularBean that exposes methods to the frontend, handle requests and return responses, access the backend via JSON-RPC calls, and implement real-time functionality using events and websockets.

javascriptsockjsangularjs;java;javaee;cdi;html5
A Closer Look At React Native
A Closer Look At React NativeA Closer Look At React Native
A Closer Look At React Native

This document provides an overview of React Native, summarizing that it allows building mobile apps using JavaScript and React by rendering UI components to native platform elements. It discusses that React Native uses no HTML, browser or webview, instead being completely powered by JavaScript communicating directly with native platform views. It then demonstrates how to build React Native apps using common components like TouchableHighlight and ListView, inline styles, and platform APIs while also addressing debugging, testing and future considerations.

javascriptmobile appsreact
GORM
Dynamic CRUD
def employee = Employee.get(1)
employee.delete()
def newEmployee = new Employee(firstName: “Joe”, lastName: ”Programmer”)
newEmployee.save()
GORM
Dynamic finders
Employee.findByLastNameAndHireDateGreaterThan(“Jones”, someDate)


findBy and findAllBy
 ●   InList - In the list of given values
 ●   LessThan - less than the given value
 ●   LessThanEquals - less than or equal a give value
 ●   GreaterThan - greater than a given value
 ●   GreaterThanEquals - greater than or equal a given value
 ●   Like - Equivalent to a SQL like expression
 ●   Ilike - Similar to a Like, except case insensitive
 ●   NotEqual - Negates equality
 ●   Between - Between two values (requires two arguments)
 ●   IsNotNull - Not a null value (doesn't require an argument)
 ●   IsNull - Is a null value (doesn't require an argument)
GORM
Hibernate HQL
Employee.findAll("from Employee as e where e.lastName like :lastName", [lastName:"Jon%"])

//with pagination and sorting
Employee.findAll("from Employee as e where e.lastName like :lastName",
                 [lastName:"Jon%", max:10, offset:20, sort:"hireDate", order:"asc"])
GORM
Simplified Hibernate Criteria API
// Find incomplete tasks assigned to Jones where the company is Monsanto
// and the project name begins with “Rubic”, order by task name
def criteria = Tasks.createCriteria()
def tasks = criteria.list {
  eq(‘completed’, false)
  project{
    like(‘name’ ‘Rubic%’)
    company{
      eq(‘name’, ‘Monsanto’)
    }
    assignedEmployees{
      eq(‘lastName’, ‘Jones’)
    }
  }
  order(‘taskName’, ‘asc’)
}

Recommended for you

Scripting Oracle Develop 2007
Scripting Oracle Develop 2007Scripting Oracle Develop 2007
Scripting Oracle Develop 2007

- Scripting languages like PHP, Python, and Ruby are becoming increasingly popular for web application development and administrative tasks due to their simplicity. - Java is embracing dynamic scripting languages through standards like JSR 223 which allows scripts like JavaScript, Groovy, and BeanShell to be integrated with Java applications and the Java platform. - Groovy is a popular Java-based scripting language that can be used to simplify and accelerate enterprise development by reducing code length and improving productivity.

groovyjavascriptscripting
Dropwizard Spring - the perfect Java REST server stack
Dropwizard Spring - the perfect Java REST server stackDropwizard Spring - the perfect Java REST server stack
Dropwizard Spring - the perfect Java REST server stack

Dropwizard is a Java framework that provides tools for building RESTful web services. It bundles several popular Java libraries - like Jersey for JAX-RS, Jetty as an embedded HTTP server, Jackson for JSON processing, Metrics for monitoring, and Hibernate Validator - into an easy to use package. Dropwizard makes it simple to build robust, production-ready REST APIs without needing a separate application server. The framework also makes it easy to integrate with Spring for dependency injection. Overall, Dropwizard provides a best-of-breed toolkit for building RESTful services in Java.

bddjavadropwizard
HTML5 New and Improved
HTML5   New and ImprovedHTML5   New and Improved
HTML5 New and Improved

HTML5 introduces many new features for web pages and applications, including semantic HTML tags, media elements, canvas drawing, geolocation, offline storage, and forms validation. The HTML5 specification from the W3C is over 900 pages and introduces these new features to enhance the capabilities of web technologies going forward.

htmlhtml5internet
Web Layer
●   Controllers built on Spring MVC
●   URL mapping conventions map requests to controllers
●   Naming and directory conventions map actions to views
●   Built-in AOP action interceptors
     ●   Every controller provides a beforeInterceptor and afterInterceptor
     ●   Specifiable by action, optionally with patterns and exclusions
●   Servlet objects and convenience extensions injected into controller actions at runtime and
    provided as implicit variables
     ●   servletContext, session, request, response, params, flash
Spring MVC
Request parameters parsed into multidimensional params map
     ●   Easily accessed with powerful Groovy map support.


<input type=”text” name=”userName” />
//controller code
def userName = params.userName


<input type=”text” name=”user.address.zipCode” />
<input type=”text” name=”user.address.state” />
//controller code
def zipCode = params.user.address.zipCode
def state = params.user.address.state
Data Binding
def save = {
    //bind params to new instance
    def user = new User(params)

    //persist
    user.save()
}


def update = {
    //get instance from database
    def user = User.get(params.id)
    //bind params
    user.properties = params
    user.save()
}
Request Format Transparency
Grails codecs (dynamic encode/decode methods) easily automap formats like XML and JSON to
the params map.


<user>
  <id>42</id>
  <address>
    <zipCode>63122</zipCode>
  </address>
</user>

//transparent to the controller code
def zipCode = params.user.address.zipCode
def user = new User(params.user)


Easily create custom codecs to support specific requirements

Recommended for you

Learn react-js
Learn react-jsLearn react-js
Learn react-js

The document provides an introduction to ReactJS, including: - ReactJS is a JavaScript library developed by Facebook for building user interfaces. - It uses virtual DOM for rendering UI components efficiently. Only updated components are re-rendered. - Components are the basic building blocks of React apps. They accept input and return React elements to describe what should appear on the screen. - The main steps to set up a React app are installing React and ReactDOM libraries, adding JSX syntax, and rendering components onto the DOM using ReactDOM.render().

javascriptreactjsapps
Implement react pagination with react hooks and react paginate
Implement react pagination with react hooks and react paginateImplement react pagination with react hooks and react paginate
Implement react pagination with react hooks and react paginate

ReactJS Pagination using React Hooks. Learn about how to implement pagination with React hooks and React paginate to manage and display the vast data conveniently.

reactjsreact paginationreact hooks
GraphQL in Symfony
GraphQL in SymfonyGraphQL in Symfony
GraphQL in Symfony

Talk about GraphQL and its implementation with Symfony using overblog/GraphQLBundle at Symfony User Group Berlin Meetup on 26.04.2017

sfugblnsymfonygraphql
XML & JSON Marshalling
Groovy's popular XML support
+
Grails builders and codecs
+
Convenience methods

def list = {
    render Project.list() as XML
}


def list = {
    render Project.list() as JSON
}
Groovy Server Pages (GSP)
●   Similar to JSP
     ●   Tag library like JSTL, but much more powerful
     ●   Easy custom tags
     ●   Powerful templates
●   SiteMesh is automatically configured for layout management
Groovy Server Pages (GSP)
Tags
   actionSubmit     fieldValue      layoutBody       render
   applyLayout      findAll         layoutHead       renderErrors
   checkBox         form            layoutTitle      resource
   collect          formRemote      link             select
   cookie           formatBoolean   localeSelect     set
   country          formatDate      message          sortableColumn
   countrySelect    formatNumber    meta             submitButton
   createLink       grep            pageProperty     submitToRemote
   createLinkTo     hasErrors       paginate         textArea
   currencySelect   header          passwordField    textField
   datePicker       hiddenField     radio            timeZoneSelect
   each             if              radioGroup       unless
   eachError        include         remoteField      uploadForm
   else             javascript      remoteFunction   while
   elseif           join            remoteLink
AJAX
●   Bundled with Prototype and Script.aculo.us
●   Excellent jQuery plugin
●   GSP tags for AJAX
     ●   Adapters built-in for major JavaScript frameworks
●   Plugins provide additional AJAX functionality

Recommended for you

DevQA: make your testers happier with Groovy, Spock and Geb
DevQA: make your testers happier with Groovy, Spock and GebDevQA: make your testers happier with Groovy, Spock and Geb
DevQA: make your testers happier with Groovy, Spock and Geb

Writing functional tests using Geb in a Grails application is fine for a development team. But when you have QA automation engineers, giving them access to the Grails app might not be the best solution (specially when they belong to a different team). So the same way DevOps allow developers and sysadmins collaborate together, let's talk about DevQA, and make them happy using a framework stack powered by Groovy. Besides above considerations, in this talk I will show a live example on how to setup an independent project for functional tests using Gradle, Groovy, Spock and Geb.

gradlegrailsspock
React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)
React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)
React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)

Binary Studio MEET FOR IT gatherings in Lviv, Ukraine: 5th of March 2016 our meetup was devoted to .NET platform and partly JS frameworks. ,

javascriptreactsoftware
React JS part 1
React JS part 1React JS part 1
React JS part 1

React is a JavaScript library for building user interfaces that allows developers to create reusable UI components. It uses a virtual DOM for efficient re-rendering when data changes, and can render components on both the client-side and server-side. Key aspects of React include JSX syntax that resembles HTML, the component model for building encapsulated components, and tools like NPM, Webpack and Babel that help support React projects.

javascriptreactjsreact
Configuration
Per-Environment Configuration Supports SCM
    ●    Package or run as any configured environment. Default environments and build configurations defined for
         development, test (staging) and production.
           ●    Programmatic environment detection with provided Environment class.


environments {
  development {
     dataSource {
       dbCreate = "create-drop" // one of 'create', 'create-drop','update'
       url = "jdbc:hsqldb:mem:devDB"
     }
  }
    test {
       dataSource {
          dbCreate = "update"
          url = "jdbc:hsqldb:mem:testDb"
       }
    }
    production {
      dataSource {
        dbCreate = "update"
        url = "jdbc:hsqldb:file:prodDb;shutdown=true"
      }
    }
}
Plugins
Grails extensions are provided as plugins
 ●   Created by core Grails team and community
 ●   Powerful – a plugin IS a Grails application
 ●   Plugins typically bring the idioms of convention-over-configuration and simplified APIs to
     popular libraries
 ●   Easy to create your own – provides a strong architecture for re-use across projects
 ●   Examples
      ●   Spring Security
      ●   JMS
      ●   Spring WS
      ●   LDAP
      ●   Quartz
Plugins
Plugin development is very active
The Bottom Line
●   Increases developer productivity
●   less code + less configuration = easier to maintain
●   Smaller learning curve than other Java web frameworks
●   Eases the learning curve for the underlying technologies
●   Project layout conventions and a standard technology stack promote quicker ramp-up time from one
    Grails project to another
●   Increases agility potential through rapid proto-typing and quick customer feedback
●   Guides solid technology choices by providing excellent defaults
●   Developers enjoy it, which promotes morale and retention

Recommended for you

IndexedDB and Push Notifications in Progressive Web Apps
IndexedDB and Push Notifications in Progressive Web AppsIndexedDB and Push Notifications in Progressive Web Apps
IndexedDB and Push Notifications in Progressive Web Apps

This document provides an overview of using IndexedDB and push notifications in progressive web apps. It discusses how to set up IndexedDB to store and retrieve data from object stores, and how to implement push notifications using Firebase Cloud Messaging (FCM). Code examples are provided to demonstrate creating an IndexedDB database, adding, retrieving, updating and deleting data, as well as setting up an FCM project, subscribing to push notifications, handling subscription, receiving push messages, and clicking on notifications. References and further reading materials are also included.

googleappsprogressive
ReactJS presentation
ReactJS presentationReactJS presentation
ReactJS presentation

Plain React detects changes by re-rendering your whole UI into a virtual DOM and then comparing it to the old version. Whatever changed, gets patched to the real DOM.

reactjavascript
Curso de Grails
Curso de GrailsCurso de Grails
Curso de Grails

Este documento fornece um resumo sobre o framework Grails: 1) Grails é um framework para desenvolvimento web baseado em Java que utiliza a linguagem Groovy; 2) Ele permite alta produtividade através de convenções que eliminam a necessidade de configuração; 3) Grails usa o padrão MVC e o ORM Hibernate para mapear classes de domínio em tabelas do banco de dados.

parnaibagrailsgroovy

More Related Content

What's hot

AngularJS Deep Dives (NYC GDG Apr 2013)
AngularJS Deep Dives (NYC GDG Apr 2013)AngularJS Deep Dives (NYC GDG Apr 2013)
AngularJS Deep Dives (NYC GDG Apr 2013)
Nitya Narasimhan
 
intoduction to Grails Framework
intoduction to Grails Frameworkintoduction to Grails Framework
intoduction to Grails Framework
Harshdeep Kaur
 
G pars
G parsG pars
Mobile Day - React Native
Mobile Day - React NativeMobile Day - React Native
Mobile Day - React Native
Software Guru
 
Getting Started With ReactJS
Getting Started With ReactJSGetting Started With ReactJS
Getting Started With ReactJS
Sandeep Kumar Patel
 
Using React with Grails 3
Using React with Grails 3Using React with Grails 3
Using React with Grails 3
Zachary Klein
 
OSGi and Spring Data for simple (Web) Application Development - Christian Bar...
OSGi and Spring Data for simple (Web) Application Development - Christian Bar...OSGi and Spring Data for simple (Web) Application Development - Christian Bar...
OSGi and Spring Data for simple (Web) Application Development - Christian Bar...
mfrancis
 
Angular beans
Angular beansAngular beans
Angular beans
Bessem Hmidi
 
A Closer Look At React Native
A Closer Look At React NativeA Closer Look At React Native
A Closer Look At React Native
Ian Wang
 
Scripting Oracle Develop 2007
Scripting Oracle Develop 2007Scripting Oracle Develop 2007
Scripting Oracle Develop 2007
Tugdual Grall
 
Dropwizard Spring - the perfect Java REST server stack
Dropwizard Spring - the perfect Java REST server stackDropwizard Spring - the perfect Java REST server stack
Dropwizard Spring - the perfect Java REST server stack
Jacek Furmankiewicz
 
HTML5 New and Improved
HTML5   New and ImprovedHTML5   New and Improved
HTML5 New and Improved
Timothy Fisher
 
Learn react-js
Learn react-jsLearn react-js
Implement react pagination with react hooks and react paginate
Implement react pagination with react hooks and react paginateImplement react pagination with react hooks and react paginate
Implement react pagination with react hooks and react paginate
Katy Slemon
 
GraphQL in Symfony
GraphQL in SymfonyGraphQL in Symfony
GraphQL in Symfony
Bernd Alter
 
DevQA: make your testers happier with Groovy, Spock and Geb
DevQA: make your testers happier with Groovy, Spock and GebDevQA: make your testers happier with Groovy, Spock and Geb
DevQA: make your testers happier with Groovy, Spock and Geb
Alvaro Sanchez-Mariscal
 
React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)
React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)
React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)
Binary Studio
 
React JS part 1
React JS part 1React JS part 1
React JS part 1
Diluka Wittahachchige
 
IndexedDB and Push Notifications in Progressive Web Apps
IndexedDB and Push Notifications in Progressive Web AppsIndexedDB and Push Notifications in Progressive Web Apps
IndexedDB and Push Notifications in Progressive Web Apps
Adégòkè Obasá
 
ReactJS presentation
ReactJS presentationReactJS presentation
ReactJS presentation
Thanh Tuong
 

What's hot (20)

AngularJS Deep Dives (NYC GDG Apr 2013)
AngularJS Deep Dives (NYC GDG Apr 2013)AngularJS Deep Dives (NYC GDG Apr 2013)
AngularJS Deep Dives (NYC GDG Apr 2013)
 
intoduction to Grails Framework
intoduction to Grails Frameworkintoduction to Grails Framework
intoduction to Grails Framework
 
G pars
G parsG pars
G pars
 
Mobile Day - React Native
Mobile Day - React NativeMobile Day - React Native
Mobile Day - React Native
 
Getting Started With ReactJS
Getting Started With ReactJSGetting Started With ReactJS
Getting Started With ReactJS
 
Using React with Grails 3
Using React with Grails 3Using React with Grails 3
Using React with Grails 3
 
OSGi and Spring Data for simple (Web) Application Development - Christian Bar...
OSGi and Spring Data for simple (Web) Application Development - Christian Bar...OSGi and Spring Data for simple (Web) Application Development - Christian Bar...
OSGi and Spring Data for simple (Web) Application Development - Christian Bar...
 
Angular beans
Angular beansAngular beans
Angular beans
 
A Closer Look At React Native
A Closer Look At React NativeA Closer Look At React Native
A Closer Look At React Native
 
Scripting Oracle Develop 2007
Scripting Oracle Develop 2007Scripting Oracle Develop 2007
Scripting Oracle Develop 2007
 
Dropwizard Spring - the perfect Java REST server stack
Dropwizard Spring - the perfect Java REST server stackDropwizard Spring - the perfect Java REST server stack
Dropwizard Spring - the perfect Java REST server stack
 
HTML5 New and Improved
HTML5   New and ImprovedHTML5   New and Improved
HTML5 New and Improved
 
Learn react-js
Learn react-jsLearn react-js
Learn react-js
 
Implement react pagination with react hooks and react paginate
Implement react pagination with react hooks and react paginateImplement react pagination with react hooks and react paginate
Implement react pagination with react hooks and react paginate
 
GraphQL in Symfony
GraphQL in SymfonyGraphQL in Symfony
GraphQL in Symfony
 
DevQA: make your testers happier with Groovy, Spock and Geb
DevQA: make your testers happier with Groovy, Spock and GebDevQA: make your testers happier with Groovy, Spock and Geb
DevQA: make your testers happier with Groovy, Spock and Geb
 
React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)
React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)
React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)
 
React JS part 1
React JS part 1React JS part 1
React JS part 1
 
IndexedDB and Push Notifications in Progressive Web Apps
IndexedDB and Push Notifications in Progressive Web AppsIndexedDB and Push Notifications in Progressive Web Apps
IndexedDB and Push Notifications in Progressive Web Apps
 
ReactJS presentation
ReactJS presentationReactJS presentation
ReactJS presentation
 

Viewers also liked

Curso de Grails
Curso de GrailsCurso de Grails
Curso de Grails
Bruno Nascimento
 
Grails
GrailsGrails
Introdução a Grails: Um framework veloz e poderoso
Introdução a Grails: Um framework veloz e poderosoIntrodução a Grails: Um framework veloz e poderoso
Introdução a Grails: Um framework veloz e poderoso
Bruno Lopes
 
Grails, o que isso quer dizer?
Grails, o que isso quer dizer?Grails, o que isso quer dizer?
Grails, o que isso quer dizer?
Gilliard Cordeiro
 
Oficina groovy grails - infoway
Oficina  groovy grails - infowayOficina  groovy grails - infoway
Oficina groovy grails - infoway
Lucas Aquiles
 
Grails Simple Login
Grails Simple LoginGrails Simple Login
Grails Simple Login
moniguna
 
AngularJS 101 - Everything you need to know to get started
AngularJS 101 - Everything you need to know to get startedAngularJS 101 - Everything you need to know to get started
AngularJS 101 - Everything you need to know to get started
Stéphane Bégaudeau
 

Viewers also liked (7)

Curso de Grails
Curso de GrailsCurso de Grails
Curso de Grails
 
Grails
GrailsGrails
Grails
 
Introdução a Grails: Um framework veloz e poderoso
Introdução a Grails: Um framework veloz e poderosoIntrodução a Grails: Um framework veloz e poderoso
Introdução a Grails: Um framework veloz e poderoso
 
Grails, o que isso quer dizer?
Grails, o que isso quer dizer?Grails, o que isso quer dizer?
Grails, o que isso quer dizer?
 
Oficina groovy grails - infoway
Oficina  groovy grails - infowayOficina  groovy grails - infoway
Oficina groovy grails - infoway
 
Grails Simple Login
Grails Simple LoginGrails Simple Login
Grails Simple Login
 
AngularJS 101 - Everything you need to know to get started
AngularJS 101 - Everything you need to know to get startedAngularJS 101 - Everything you need to know to get started
AngularJS 101 - Everything you need to know to get started
 

Similar to Grails 101

Groovy and Grails intro
Groovy and Grails introGroovy and Grails intro
Groovy and Grails intro
Miguel Pastor
 
Ad111
Ad111Ad111
Ad111
ddrschiw
 
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
ddrschiw
 
AngularJS Workshop
AngularJS WorkshopAngularJS Workshop
AngularJS Workshop
Gianluca Cacace
 
Silicon Valley JUG - How to generate customized java 8 code from your database
Silicon Valley JUG - How to generate customized java 8 code from your databaseSilicon Valley JUG - How to generate customized java 8 code from your database
Silicon Valley JUG - How to generate customized java 8 code from your database
Speedment, Inc.
 
How to generate customized java 8 code from your database
How to generate customized java 8 code from your databaseHow to generate customized java 8 code from your database
How to generate customized java 8 code from your database
Speedment, Inc.
 
Dynamic Languages Web Frameworks Indicthreads 2009
Dynamic Languages Web Frameworks Indicthreads 2009Dynamic Languages Web Frameworks Indicthreads 2009
Dynamic Languages Web Frameworks Indicthreads 2009
Arun Gupta
 
Up and Running with gRPC & Cloud Career [GDG-Cloud-Dhaka-IO/2022}
Up and Running with gRPC & Cloud Career [GDG-Cloud-Dhaka-IO/2022}Up and Running with gRPC & Cloud Career [GDG-Cloud-Dhaka-IO/2022}
Up and Running with gRPC & Cloud Career [GDG-Cloud-Dhaka-IO/2022}
Md. Sadhan Sarker
 
Optimization and fault tolerance in distributed transaction with Node.JS Grap...
Optimization and fault tolerance in distributed transaction with Node.JS Grap...Optimization and fault tolerance in distributed transaction with Node.JS Grap...
Optimization and fault tolerance in distributed transaction with Node.JS Grap...
Thien Ly
 
Dynamic Groovy Edges
Dynamic Groovy EdgesDynamic Groovy Edges
Dynamic Groovy Edges
Jimmy Ray
 
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...
Amazon Web Services Japan
 
DevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
DevOpsDays Taipei 2019 - Mastering IaC the DevOps WayDevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
DevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
smalltown
 
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB
 
GraphQL_devoxx_2023.pptx
GraphQL_devoxx_2023.pptxGraphQL_devoxx_2023.pptx
GraphQL_devoxx_2023.pptx
Soham Dasgupta
 
GQuery a jQuery clone for Gwt, RivieraDev 2011
GQuery a jQuery clone for Gwt, RivieraDev 2011GQuery a jQuery clone for Gwt, RivieraDev 2011
GQuery a jQuery clone for Gwt, RivieraDev 2011
Manuel Carrasco Moñino
 
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)
lennartkats
 
Do we need a serverless framework? With Python, I did not
Do we need a serverless framework? With Python, I did notDo we need a serverless framework? With Python, I did not
Do we need a serverless framework? With Python, I did not
Cristóbal García García
 
Javascript ui for rest services
Javascript ui for rest servicesJavascript ui for rest services
Javascript ui for rest services
Ioan Eugen Stan
 
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
Codemotion
 
Gradle
GradleGradle
Gradle
Han Yin
 

Similar to Grails 101 (20)

Groovy and Grails intro
Groovy and Grails introGroovy and Grails intro
Groovy and Grails intro
 
Ad111
Ad111Ad111
Ad111
 
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
 
AngularJS Workshop
AngularJS WorkshopAngularJS Workshop
AngularJS Workshop
 
Silicon Valley JUG - How to generate customized java 8 code from your database
Silicon Valley JUG - How to generate customized java 8 code from your databaseSilicon Valley JUG - How to generate customized java 8 code from your database
Silicon Valley JUG - How to generate customized java 8 code from your database
 
How to generate customized java 8 code from your database
How to generate customized java 8 code from your databaseHow to generate customized java 8 code from your database
How to generate customized java 8 code from your database
 
Dynamic Languages Web Frameworks Indicthreads 2009
Dynamic Languages Web Frameworks Indicthreads 2009Dynamic Languages Web Frameworks Indicthreads 2009
Dynamic Languages Web Frameworks Indicthreads 2009
 
Up and Running with gRPC & Cloud Career [GDG-Cloud-Dhaka-IO/2022}
Up and Running with gRPC & Cloud Career [GDG-Cloud-Dhaka-IO/2022}Up and Running with gRPC & Cloud Career [GDG-Cloud-Dhaka-IO/2022}
Up and Running with gRPC & Cloud Career [GDG-Cloud-Dhaka-IO/2022}
 
Optimization and fault tolerance in distributed transaction with Node.JS Grap...
Optimization and fault tolerance in distributed transaction with Node.JS Grap...Optimization and fault tolerance in distributed transaction with Node.JS Grap...
Optimization and fault tolerance in distributed transaction with Node.JS Grap...
 
Dynamic Groovy Edges
Dynamic Groovy EdgesDynamic Groovy Edges
Dynamic Groovy Edges
 
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...
 
DevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
DevOpsDays Taipei 2019 - Mastering IaC the DevOps WayDevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
DevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
 
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
 
GraphQL_devoxx_2023.pptx
GraphQL_devoxx_2023.pptxGraphQL_devoxx_2023.pptx
GraphQL_devoxx_2023.pptx
 
GQuery a jQuery clone for Gwt, RivieraDev 2011
GQuery a jQuery clone for Gwt, RivieraDev 2011GQuery a jQuery clone for Gwt, RivieraDev 2011
GQuery a jQuery clone for Gwt, RivieraDev 2011
 
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)
 
Do we need a serverless framework? With Python, I did not
Do we need a serverless framework? With Python, I did notDo we need a serverless framework? With Python, I did not
Do we need a serverless framework? With Python, I did not
 
Javascript ui for rest services
Javascript ui for rest servicesJavascript ui for rest services
Javascript ui for rest services
 
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
 
Gradle
GradleGradle
Gradle
 

Recently uploaded

Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Chris Swan
 
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
Bert Blevins
 
7 Most Powerful Solar Storms in the History of Earth.pdf
7 Most Powerful Solar Storms in the History of Earth.pdf7 Most Powerful Solar Storms in the History of Earth.pdf
7 Most Powerful Solar Storms in the History of Earth.pdf
Enterprise Wired
 
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdfBT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
Neo4j
 
20240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 202420240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 2024
Matthew Sinclair
 
Calgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptxCalgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptx
ishalveerrandhawa1
 
Comparison Table of DiskWarrior Alternatives.pdf
Comparison Table of DiskWarrior Alternatives.pdfComparison Table of DiskWarrior Alternatives.pdf
Comparison Table of DiskWarrior Alternatives.pdf
Andrey Yasko
 
How Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdfHow Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdf
HackersList
 
What’s New in Teams Calling, Meetings and Devices May 2024
What’s New in Teams Calling, Meetings and Devices May 2024What’s New in Teams Calling, Meetings and Devices May 2024
What’s New in Teams Calling, Meetings and Devices May 2024
Stephanie Beckett
 
How RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptxHow RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptx
SynapseIndia
 
find out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challengesfind out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challenges
huseindihon
 
Advanced Techniques for Cyber Security Analysis and Anomaly Detection
Advanced Techniques for Cyber Security Analysis and Anomaly DetectionAdvanced Techniques for Cyber Security Analysis and Anomaly Detection
Advanced Techniques for Cyber Security Analysis and Anomaly Detection
Bert Blevins
 
20240705 QFM024 Irresponsible AI Reading List June 2024
20240705 QFM024 Irresponsible AI Reading List June 202420240705 QFM024 Irresponsible AI Reading List June 2024
20240705 QFM024 Irresponsible AI Reading List June 2024
Matthew Sinclair
 
DealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 editionDealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 edition
Yevgen Sysoyev
 
Quality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of TimeQuality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of Time
Aurora Consulting
 
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-InTrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc
 
Coordinate Systems in FME 101 - Webinar Slides
Coordinate Systems in FME 101 - Webinar SlidesCoordinate Systems in FME 101 - Webinar Slides
Coordinate Systems in FME 101 - Webinar Slides
Safe Software
 
WPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide DeckWPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide Deck
Lidia A.
 
20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf
Sally Laouacheria
 
Measuring the Impact of Network Latency at Twitter
Measuring the Impact of Network Latency at TwitterMeasuring the Impact of Network Latency at Twitter
Measuring the Impact of Network Latency at Twitter
ScyllaDB
 

Recently uploaded (20)

Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
 
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
 
7 Most Powerful Solar Storms in the History of Earth.pdf
7 Most Powerful Solar Storms in the History of Earth.pdf7 Most Powerful Solar Storms in the History of Earth.pdf
7 Most Powerful Solar Storms in the History of Earth.pdf
 
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdfBT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
 
20240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 202420240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 2024
 
Calgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptxCalgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptx
 
Comparison Table of DiskWarrior Alternatives.pdf
Comparison Table of DiskWarrior Alternatives.pdfComparison Table of DiskWarrior Alternatives.pdf
Comparison Table of DiskWarrior Alternatives.pdf
 
How Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdfHow Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdf
 
What’s New in Teams Calling, Meetings and Devices May 2024
What’s New in Teams Calling, Meetings and Devices May 2024What’s New in Teams Calling, Meetings and Devices May 2024
What’s New in Teams Calling, Meetings and Devices May 2024
 
How RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptxHow RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptx
 
find out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challengesfind out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challenges
 
Advanced Techniques for Cyber Security Analysis and Anomaly Detection
Advanced Techniques for Cyber Security Analysis and Anomaly DetectionAdvanced Techniques for Cyber Security Analysis and Anomaly Detection
Advanced Techniques for Cyber Security Analysis and Anomaly Detection
 
20240705 QFM024 Irresponsible AI Reading List June 2024
20240705 QFM024 Irresponsible AI Reading List June 202420240705 QFM024 Irresponsible AI Reading List June 2024
20240705 QFM024 Irresponsible AI Reading List June 2024
 
DealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 editionDealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 edition
 
Quality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of TimeQuality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of Time
 
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-InTrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
 
Coordinate Systems in FME 101 - Webinar Slides
Coordinate Systems in FME 101 - Webinar SlidesCoordinate Systems in FME 101 - Webinar Slides
Coordinate Systems in FME 101 - Webinar Slides
 
WPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide DeckWPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide Deck
 
20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf
 
Measuring the Impact of Network Latency at Twitter
Measuring the Impact of Network Latency at TwitterMeasuring the Impact of Network Latency at Twitter
Measuring the Impact of Network Latency at Twitter
 

Grails 101

  • 2. About Me David Jacobs ● Web Developer since '98 ● Groovy since '06 Twitter @MetaThis ● Grails focus in '08-'09
  • 3. What is Grails? Grails is an open-source framework for high-velocity development of Spring applications ● Sensible defaults ● Convention-over-configuration ● DRY ● Dynamic metaprogramming ● End-to-end integrated stack ● Enables you to focus on the business problem
  • 4. Best-of-Breed Java Technologies ● Spring ● Spring MVC ● Hibernate ● log4j ● jUnit ● SiteMesh
  • 5. Integrated Stack ● Layers and technologies integrated and wired out-of-the-box ● Default configurations based on industry best practices ● 80/20 rule
  • 6. Directory Structure ● grails-app - top level directory for Groovy sources ● conf - Configuration sources. ● controller - Web controllers - The C in MVC. ● domain - The application domain. ● i18n - Support for internationalization (i18n). ● services - The service layer. ● taglib - Tag libraries. ● views - Groovy Server Pages. ● scripts - Gant/Gradle scripts. ● src - Supporting sources ● groovy - Other Groovy sources ● java - Other Java sources ● test - Unit and integration test
  • 7. GORM ● Object Relational Mapping (ORM) ● Data access layer ● Simplifies configuration through conventions ● Defaults to Hibernate implementation ● Provided as plugin, alternatives pluggable ● Extends and simplifies data access APIs ● Similar to ActiveRecord in Rails
  • 8. GORM Domain Modeling //this is a complete Hibernate mapping! class Employee { String firstName String lastName Date startDate }
  • 9. GORM Dynamic CRUD def employee = Employee.get(1) employee.delete() def newEmployee = new Employee(firstName: “Joe”, lastName: ”Programmer”) newEmployee.save()
  • 10. GORM Dynamic finders Employee.findByLastNameAndHireDateGreaterThan(“Jones”, someDate) findBy and findAllBy ● InList - In the list of given values ● LessThan - less than the given value ● LessThanEquals - less than or equal a give value ● GreaterThan - greater than a given value ● GreaterThanEquals - greater than or equal a given value ● Like - Equivalent to a SQL like expression ● Ilike - Similar to a Like, except case insensitive ● NotEqual - Negates equality ● Between - Between two values (requires two arguments) ● IsNotNull - Not a null value (doesn't require an argument) ● IsNull - Is a null value (doesn't require an argument)
  • 11. GORM Hibernate HQL Employee.findAll("from Employee as e where e.lastName like :lastName", [lastName:"Jon%"]) //with pagination and sorting Employee.findAll("from Employee as e where e.lastName like :lastName", [lastName:"Jon%", max:10, offset:20, sort:"hireDate", order:"asc"])
  • 12. GORM Simplified Hibernate Criteria API // Find incomplete tasks assigned to Jones where the company is Monsanto // and the project name begins with “Rubic”, order by task name def criteria = Tasks.createCriteria() def tasks = criteria.list { eq(‘completed’, false) project{ like(‘name’ ‘Rubic%’) company{ eq(‘name’, ‘Monsanto’) } assignedEmployees{ eq(‘lastName’, ‘Jones’) } } order(‘taskName’, ‘asc’) }
  • 13. Web Layer ● Controllers built on Spring MVC ● URL mapping conventions map requests to controllers ● Naming and directory conventions map actions to views ● Built-in AOP action interceptors ● Every controller provides a beforeInterceptor and afterInterceptor ● Specifiable by action, optionally with patterns and exclusions ● Servlet objects and convenience extensions injected into controller actions at runtime and provided as implicit variables ● servletContext, session, request, response, params, flash
  • 14. Spring MVC Request parameters parsed into multidimensional params map ● Easily accessed with powerful Groovy map support. <!-- HTML form --> <input type=”text” name=”userName” /> //controller code def userName = params.userName <!-- HTML form with dot-notation for complex embedded objects --> <input type=”text” name=”user.address.zipCode” /> <input type=”text” name=”user.address.state” /> //controller code def zipCode = params.user.address.zipCode def state = params.user.address.state
  • 15. Data Binding def save = { //bind params to new instance def user = new User(params) //persist user.save() } def update = { //get instance from database def user = User.get(params.id) //bind params user.properties = params user.save() }
  • 16. Request Format Transparency Grails codecs (dynamic encode/decode methods) easily automap formats like XML and JSON to the params map. <!-- XML request --> <user> <id>42</id> <address> <zipCode>63122</zipCode> </address> </user> //transparent to the controller code def zipCode = params.user.address.zipCode def user = new User(params.user) Easily create custom codecs to support specific requirements
  • 17. XML & JSON Marshalling Groovy's popular XML support + Grails builders and codecs + Convenience methods def list = { render Project.list() as XML } def list = { render Project.list() as JSON }
  • 18. Groovy Server Pages (GSP) ● Similar to JSP ● Tag library like JSTL, but much more powerful ● Easy custom tags ● Powerful templates ● SiteMesh is automatically configured for layout management
  • 19. Groovy Server Pages (GSP) Tags actionSubmit fieldValue layoutBody render applyLayout findAll layoutHead renderErrors checkBox form layoutTitle resource collect formRemote link select cookie formatBoolean localeSelect set country formatDate message sortableColumn countrySelect formatNumber meta submitButton createLink grep pageProperty submitToRemote createLinkTo hasErrors paginate textArea currencySelect header passwordField textField datePicker hiddenField radio timeZoneSelect each if radioGroup unless eachError include remoteField uploadForm else javascript remoteFunction while elseif join remoteLink
  • 20. AJAX ● Bundled with Prototype and Script.aculo.us ● Excellent jQuery plugin ● GSP tags for AJAX ● Adapters built-in for major JavaScript frameworks ● Plugins provide additional AJAX functionality
  • 21. Configuration Per-Environment Configuration Supports SCM ● Package or run as any configured environment. Default environments and build configurations defined for development, test (staging) and production. ● Programmatic environment detection with provided Environment class. environments { development { dataSource { dbCreate = "create-drop" // one of 'create', 'create-drop','update' url = "jdbc:hsqldb:mem:devDB" } } test { dataSource { dbCreate = "update" url = "jdbc:hsqldb:mem:testDb" } } production { dataSource { dbCreate = "update" url = "jdbc:hsqldb:file:prodDb;shutdown=true" } } }
  • 22. Plugins Grails extensions are provided as plugins ● Created by core Grails team and community ● Powerful – a plugin IS a Grails application ● Plugins typically bring the idioms of convention-over-configuration and simplified APIs to popular libraries ● Easy to create your own – provides a strong architecture for re-use across projects ● Examples ● Spring Security ● JMS ● Spring WS ● LDAP ● Quartz
  • 24. The Bottom Line ● Increases developer productivity ● less code + less configuration = easier to maintain ● Smaller learning curve than other Java web frameworks ● Eases the learning curve for the underlying technologies ● Project layout conventions and a standard technology stack promote quicker ramp-up time from one Grails project to another ● Increases agility potential through rapid proto-typing and quick customer feedback ● Guides solid technology choices by providing excellent defaults ● Developers enjoy it, which promotes morale and retention