SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.
SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.
Successfully reported this slideshow.
Activate your 14 day free trial to unlock unlimited reading.
2.
Peter Maas ~ Works at Finalist IT
Group. 70% Developer, 25% Architect
and 5% CTO Board. Experience
includes Java/JEE, Spring, Hibernate,
i B a t i s , J S F, S t r u t s , M M B a s e.
Passionate about scripting languages
for the JVM like Groovy and JRuby.
3.
So, what is Grails?
In its' essence Grails is an MVC action-based webframework
· CoC: convention over configuration
· DRY: don't repeat yourself
· TDD: test driven development
· Combines advantages of frameworks like
RoR/Django/Turbogears with proven Java technology
6.
Key Advantages
· Lowers the steep learningcurve of the Java platform
· Brings (back) both productivity and pleasure of development
· Lets you build applications in an incremental/iterative way
· Allows you to scale your application in complexity and infrastructure
7.
DEMO
Battle
Registration Presentation
1 name 1
* * name
name
description
email description
date
8.
Domain classes
class Registration {
class Battle { class Presentation {
String name
String name String name
String email
String description String description
Criteria
Battle battle
Date date Battle battle
static belongsTo = [Battle]
static hasMany = static belongsTo = [Battle]
def listByRegistration = {
[presentations:Presentation,registrations:Registration]
def c = Battle.createCriteria()
static constraints = {
def results = c{
static constraints = { static constraints = {
name(blank: false)
registrations{
name(blank: false) name(blank: false)
email(blank: false,
like(quot;namequot;,quot;%${params.name}%quot;)
description(blank: false) description(blank: false)
email: true)
}
date(nullable: false) battle(nullable: false)
battle(nullable: false)
order(quot;datequot;,quot;descquot;)
} }
}
}
def String toString(){ def String toString() {
def String toString() {
render(view:'list',model:[battleList: results])
return name return name
return name
}
} }
}
} }
}
g:textArea
Bootstrap
Battle b =
new Battle(name: quot;Battle of the Geeks 2007quot;, description: quot;Finalists BOTG 2007quot;, date: new Date()) <g:textArea name=quot;myFieldquot; value=quot;myValuequot; rows=quot;5quot; cols=quot;40quot;/>
b.save()
[quot;CMScquot;, quot;Guicequot;,quot;Grailsquot;,quot;Mulequot;].each{
Spring config
Presentation p =
new Presentation(name: quot;${it} presentationquot;, description: quot;presentation about ${it}quot;, battle: b)
p.save()
}
<bean id=quot;textileParserquot; class=quot;com.plink.plextile.TextParserquot;/>
Taglib Render AS
import com.plink.plextile.*;
import grails.converters.*
class TextileTagLib {
...
TextParser textileParser
def showXML = {
def renderTextile = { attrs ->
Battle b = Battle.get( params.id)
out << textileParser.parseTextile(attrs.value, true)
render b as XML
}
}
}
0 likes
Be the first to like this
Views
Total views
889
On SlideShare
0
From Embeds
0
Number of Embeds
50
You have now unlocked unlimited access to 20M+ documents!
Unlimited Reading
Learn faster and smarter from top experts
Unlimited Downloading
Download to take your learnings offline and on the go
You also get free access to Scribd!
Instant access to millions of ebooks, audiobooks, magazines, podcasts and more.
Read and listen offline with any device.
Free access to premium services like Tuneln, Mubi and more.