going further with grails - jason...
TRANSCRIPT
![Page 1: Going Further with Grails - Jason Rudolphjasonrudolph.com/downloads/presentations/Going_Further_with_Grails.pdfGoing Further with Grails Jason Rudolph jason@thinkrelevance.com. Introduction](https://reader030.vdocument.in/reader030/viewer/2022021515/5b18226f7f8b9a46258b8290/html5/thumbnails/1.jpg)
Published under the Creative Commons Attribution Noncommercial Share Alike License Version 2.5. (Please see http://creativecommons.org/licenses/by-nc-sa/2.5 for complete details.)
Going Further with Grails
Jason [email protected]
![Page 2: Going Further with Grails - Jason Rudolphjasonrudolph.com/downloads/presentations/Going_Further_with_Grails.pdfGoing Further with Grails Jason Rudolph jason@thinkrelevance.com. Introduction](https://reader030.vdocument.in/reader030/viewer/2022021515/5b18226f7f8b9a46258b8290/html5/thumbnails/2.jpg)
Introduction
Jason Rudolph
jasonrudolph.com
thinkrelevance.com
![Page 3: Going Further with Grails - Jason Rudolphjasonrudolph.com/downloads/presentations/Going_Further_with_Grails.pdfGoing Further with Grails Jason Rudolph jason@thinkrelevance.com. Introduction](https://reader030.vdocument.in/reader030/viewer/2022021515/5b18226f7f8b9a46258b8290/html5/thumbnails/3.jpg)
Agenda
Beyond scaffolding
When the UI and the DB disagree
DRY UI
Business logic, right where it belongs
Calling in the Java infantry
Security? Just plug it in
![Page 4: Going Further with Grails - Jason Rudolphjasonrudolph.com/downloads/presentations/Going_Further_with_Grails.pdfGoing Further with Grails Jason Rudolph jason@thinkrelevance.com. Introduction](https://reader030.vdocument.in/reader030/viewer/2022021515/5b18226f7f8b9a46258b8290/html5/thumbnails/4.jpg)
scaffolding.next()Demo
![Page 5: Going Further with Grails - Jason Rudolphjasonrudolph.com/downloads/presentations/Going_Further_with_Grails.pdfGoing Further with Grails Jason Rudolph jason@thinkrelevance.com. Introduction](https://reader030.vdocument.in/reader030/viewer/2022021515/5b18226f7f8b9a46258b8290/html5/thumbnails/5.jpg)
Tag Libraries
Pre-packaged tags
Logical - if, else, etc.
Iterative - while, each, findAll, etc.
Form - textField, checkBox, datePicker, etc.
Rendering - layoutBody, paginate, etc.
Ajax - remoteField, submitToRemote, etc.
And others...
![Page 6: Going Further with Grails - Jason Rudolphjasonrudolph.com/downloads/presentations/Going_Further_with_Grails.pdfGoing Further with Grails Jason Rudolph jason@thinkrelevance.com. Introduction](https://reader030.vdocument.in/reader030/viewer/2022021515/5b18226f7f8b9a46258b8290/html5/thumbnails/6.jpg)
Tag Libraries (cont’d)Custom tags
Named (and found by Grails) using convention
Names end with "TagLib" (e.g., RacetrackTagLib.groovy)
Located in grails-app/taglib
Implemented as closures
No TLDs necessary
User-contributed tags
![Page 7: Going Further with Grails - Jason Rudolphjasonrudolph.com/downloads/presentations/Going_Further_with_Grails.pdfGoing Further with Grails Jason Rudolph jason@thinkrelevance.com. Introduction](https://reader030.vdocument.in/reader030/viewer/2022021515/5b18226f7f8b9a46258b8290/html5/thumbnails/7.jpg)
Command & ConquerDemo
![Page 8: Going Further with Grails - Jason Rudolphjasonrudolph.com/downloads/presentations/Going_Further_with_Grails.pdfGoing Further with Grails Jason Rudolph jason@thinkrelevance.com. Introduction](https://reader030.vdocument.in/reader030/viewer/2022021515/5b18226f7f8b9a46258b8290/html5/thumbnails/8.jpg)
Command Objects
Why?
Business objects minus persistence, or
View-centric adaption of the domain
Auto-populated from request params
Play nicely with constraints
At home in src/groovy, grails-app/controllers, or directly inside the controller
![Page 9: Going Further with Grails - Jason Rudolphjasonrudolph.com/downloads/presentations/Going_Further_with_Grails.pdfGoing Further with Grails Jason Rudolph jason@thinkrelevance.com. Introduction](https://reader030.vdocument.in/reader030/viewer/2022021515/5b18226f7f8b9a46258b8290/html5/thumbnails/9.jpg)
“Flash” Cards
![Page 10: Going Further with Grails - Jason Rudolphjasonrudolph.com/downloads/presentations/Going_Further_with_Grails.pdfGoing Further with Grails Jason Rudolph jason@thinkrelevance.com. Introduction](https://reader030.vdocument.in/reader030/viewer/2022021515/5b18226f7f8b9a46258b8290/html5/thumbnails/10.jpg)
redirect_after_post == good
![Page 11: Going Further with Grails - Jason Rudolphjasonrudolph.com/downloads/presentations/Going_Further_with_Grails.pdfGoing Further with Grails Jason Rudolph jason@thinkrelevance.com. Introduction](https://reader030.vdocument.in/reader030/viewer/2022021515/5b18226f7f8b9a46258b8290/html5/thumbnails/11.jpg)
!manual_session_cleanup
![Page 12: Going Further with Grails - Jason Rudolphjasonrudolph.com/downloads/presentations/Going_Further_with_Grails.pdfGoing Further with Grails Jason Rudolph jason@thinkrelevance.com. Introduction](https://reader030.vdocument.in/reader030/viewer/2022021515/5b18226f7f8b9a46258b8290/html5/thumbnails/12.jpg)
request < flash < session
![Page 13: Going Further with Grails - Jason Rudolphjasonrudolph.com/downloads/presentations/Going_Further_with_Grails.pdfGoing Further with Grails Jason Rudolph jason@thinkrelevance.com. Introduction](https://reader030.vdocument.in/reader030/viewer/2022021515/5b18226f7f8b9a46258b8290/html5/thumbnails/13.jpg)
flash.lifetime == request.lifetime++
![Page 14: Going Further with Grails - Jason Rudolphjasonrudolph.com/downloads/presentations/Going_Further_with_Grails.pdfGoing Further with Grails Jason Rudolph jason@thinkrelevance.com. Introduction](https://reader030.vdocument.in/reader030/viewer/2022021515/5b18226f7f8b9a46258b8290/html5/thumbnails/14.jpg)
Talking BackDemo
![Page 15: Going Further with Grails - Jason Rudolphjasonrudolph.com/downloads/presentations/Going_Further_with_Grails.pdfGoing Further with Grails Jason Rudolph jason@thinkrelevance.com. Introduction](https://reader030.vdocument.in/reader030/viewer/2022021515/5b18226f7f8b9a46258b8290/html5/thumbnails/15.jpg)
LayoutsPowered by SiteMesh
A home for common site assets
Menus, headers, footers
Global CSS and JavaScript
Global metadata
Precedence rules
Explicitly declared layouts
Layout by convention
![Page 16: Going Further with Grails - Jason Rudolphjasonrudolph.com/downloads/presentations/Going_Further_with_Grails.pdfGoing Further with Grails Jason Rudolph jason@thinkrelevance.com. Introduction](https://reader030.vdocument.in/reader030/viewer/2022021515/5b18226f7f8b9a46258b8290/html5/thumbnails/16.jpg)
Where’s My Layout?
1. Is it declared in the view?
<meta name="layout" content="foo" />
2. Fallback to convention. Layout for this view?
/views/layouts/sponsorship/create.gsp
3. Layout for this controller?
/views/layouts/sponsorship.gsp
4. Punt!
Rendering views/sponsorship/create.gsp ...
![Page 17: Going Further with Grails - Jason Rudolphjasonrudolph.com/downloads/presentations/Going_Further_with_Grails.pdfGoing Further with Grails Jason Rudolph jason@thinkrelevance.com. Introduction](https://reader030.vdocument.in/reader030/viewer/2022021515/5b18226f7f8b9a46258b8290/html5/thumbnails/17.jpg)
Partial Templates
Why? DRY UI!
Naming
Locating
Passing variables
bean
collection
hash
![Page 18: Going Further with Grails - Jason Rudolphjasonrudolph.com/downloads/presentations/Going_Further_with_Grails.pdfGoing Further with Grails Jason Rudolph jason@thinkrelevance.com. Introduction](https://reader030.vdocument.in/reader030/viewer/2022021515/5b18226f7f8b9a46258b8290/html5/thumbnails/18.jpg)
It’s All Relative
<!-- ... --><g:render template="foo"><!-- ... -->
views/sponsorship/create.gsp
![Page 19: Going Further with Grails - Jason Rudolphjasonrudolph.com/downloads/presentations/Going_Further_with_Grails.pdfGoing Further with Grails Jason Rudolph jason@thinkrelevance.com. Introduction](https://reader030.vdocument.in/reader030/viewer/2022021515/5b18226f7f8b9a46258b8290/html5/thumbnails/19.jpg)
From the Top
<!-- ... --><g:render template="/shared/foo"><!-- ... -->
views/sponsorship/create.gsp
![Page 20: Going Further with Grails - Jason Rudolphjasonrudolph.com/downloads/presentations/Going_Further_with_Grails.pdfGoing Further with Grails Jason Rudolph jason@thinkrelevance.com. Introduction](https://reader030.vdocument.in/reader030/viewer/2022021515/5b18226f7f8b9a46258b8290/html5/thumbnails/20.jpg)
Partial Templates
Why? DRY UI!
Naming
Locating
Passing variables
bean
collection
hash
![Page 21: Going Further with Grails - Jason Rudolphjasonrudolph.com/downloads/presentations/Going_Further_with_Grails.pdfGoing Further with Grails Jason Rudolph jason@thinkrelevance.com. Introduction](https://reader030.vdocument.in/reader030/viewer/2022021515/5b18226f7f8b9a46258b8290/html5/thumbnails/21.jpg)
At Your ServiceDemo
![Page 22: Going Further with Grails - Jason Rudolphjasonrudolph.com/downloads/presentations/Going_Further_with_Grails.pdfGoing Further with Grails Jason Rudolph jason@thinkrelevance.com. Introduction](https://reader030.vdocument.in/reader030/viewer/2022021515/5b18226f7f8b9a46258b8290/html5/thumbnails/22.jpg)
Services
Declarative transactionality
Flexible scoping
Zero-configuration dependency injection
![Page 23: Going Further with Grails - Jason Rudolphjasonrudolph.com/downloads/presentations/Going_Further_with_Grails.pdfGoing Further with Grails Jason Rudolph jason@thinkrelevance.com. Introduction](https://reader030.vdocument.in/reader030/viewer/2022021515/5b18226f7f8b9a46258b8290/html5/thumbnails/23.jpg)
Calling All JARsDemo
![Page 24: Going Further with Grails - Jason Rudolphjasonrudolph.com/downloads/presentations/Going_Further_with_Grails.pdfGoing Further with Grails Jason Rudolph jason@thinkrelevance.com. Introduction](https://reader030.vdocument.in/reader030/viewer/2022021515/5b18226f7f8b9a46258b8290/html5/thumbnails/24.jpg)
Security
Authenticate
Authorize
Administer
http://www.flickr.com/photos/amagill/235453953/Used under Creative Commons Attribution 2.0 Generic License (http://creativecommons.org/licenses/by/2.0/deed.en-us)
![Page 25: Going Further with Grails - Jason Rudolphjasonrudolph.com/downloads/presentations/Going_Further_with_Grails.pdfGoing Further with Grails Jason Rudolph jason@thinkrelevance.com. Introduction](https://reader030.vdocument.in/reader030/viewer/2022021515/5b18226f7f8b9a46258b8290/html5/thumbnails/25.jpg)
Acegi Plugin
User account management
Password encryption
Log in & log out interface
Role management
Resource management
Hide/show UI elements based on user roles
Registration e-mails
![Page 26: Going Further with Grails - Jason Rudolphjasonrudolph.com/downloads/presentations/Going_Further_with_Grails.pdfGoing Further with Grails Jason Rudolph jason@thinkrelevance.com. Introduction](https://reader030.vdocument.in/reader030/viewer/2022021515/5b18226f7f8b9a46258b8290/html5/thumbnails/26.jpg)
Lock-downDemo
![Page 27: Going Further with Grails - Jason Rudolphjasonrudolph.com/downloads/presentations/Going_Further_with_Grails.pdfGoing Further with Grails Jason Rudolph jason@thinkrelevance.com. Introduction](https://reader030.vdocument.in/reader030/viewer/2022021515/5b18226f7f8b9a46258b8290/html5/thumbnails/27.jpg)
Whew!
It ain’t just scaffolding
The UI and the DB needn’t always agree
Banishing UI redundancy
Thin controllers, fat services
Java at your fingertips
Plug in and go
![Page 28: Going Further with Grails - Jason Rudolphjasonrudolph.com/downloads/presentations/Going_Further_with_Grails.pdfGoing Further with Grails Jason Rudolph jason@thinkrelevance.com. Introduction](https://reader030.vdocument.in/reader030/viewer/2022021515/5b18226f7f8b9a46258b8290/html5/thumbnails/28.jpg)
Resources
grails.org
Downloads
Latest Release (1.0.1)
Development Snapshot (1.0.2)
User guide, tutorials, screencasts, etc.
Mailing lists (grails.org/mailing+lists)
![Page 29: Going Further with Grails - Jason Rudolphjasonrudolph.com/downloads/presentations/Going_Further_with_Grails.pdfGoing Further with Grails Jason Rudolph jason@thinkrelevance.com. Introduction](https://reader030.vdocument.in/reader030/viewer/2022021515/5b18226f7f8b9a46258b8290/html5/thumbnails/29.jpg)
![Page 30: Going Further with Grails - Jason Rudolphjasonrudolph.com/downloads/presentations/Going_Further_with_Grails.pdfGoing Further with Grails Jason Rudolph jason@thinkrelevance.com. Introduction](https://reader030.vdocument.in/reader030/viewer/2022021515/5b18226f7f8b9a46258b8290/html5/thumbnails/30.jpg)
Slides & Examples Available
@
jasonrudolph.com/downloads
Please Fill Out Your Evaluations
This presentation is published under the Creative Commons Attribution Noncommercial Share Alike License Version 2.5.
(Please see http://creativecommons.org/licenses/by-nc-sa/2.5 for complete details.)