SlideShare a Scribd company logo
1 of 15
Data Binding
in Grails
Agenda
1. What is data binding?
2. What arethe possible scenarios?
3. What options does Grails provides for data binding?
4. Security concerns
Introduction to AWS CodeDeploy
• Single domain classform
• Multiple instances of a domain class
• Associations
• A domain object with file
Single Domain Class
def save={
def b =new Book()
b.properties =params
b.save()
}
Single Domain Class
def save={
def b =new Book(params)
b.save()
}
def update ={
def b =Book.get(params.id)
b.properties =params
b.save()
}
BindData examples
// request parameters to a target object
bindData(target,this.params)
// exclude firstName and lastName
bindData(target,this.params,['firstName', 'lastName'])
// only use parameters starting with"author." e.g.
author.email
bindData(target,this.params, "author")
BindData examples
// exclude firstName and lastName and only use
parameters starting with "author." e.g. author.email
bindData(target,this.params,['firstName','lastName'],
"author")
Binding with Associations
class SomeCO{
Date startDate;
Date endDate;
Project project
}
<g:datePicker name="startDate"/>
<g:datePicker name="startDate"/>
<g:select name="project.id" from="${someList}"
value="${project?.name}" optionKey="id"/>
def myAction{SomeCO
someCO ->
// perform action
}
Binding with Associations
class Book{
String name
Author author
}
<input type="text" name="book.name"
<input type="text" name="author.name"
class Author{
Stringname
}
def b =new Book(params['book'])
def a =new Author(params['author'])
Binding with Associations
<g:form action=”save”>
Title:<input type=”text” name=”album.title” /><br>
Artist:<input type=”text” name=”artist.name” /><br>
Song 1:<input type=”text” name=”songs[0].name”/><br>
Song 2:<input type=”text” name=”songs[1].name”/><br>
Song 3:<input type=”text” name=”songs[3].name”/><br>
</g:form>
Addressing Security Concerns
Use Special Command Objects
Use “excludes” parameter
References / Attribution
DGG –Second Edition –Chapter4
http://grails.org/Controllers+-+Data+Binding
License
Thiswork islicensed under the Creative Commons
Attribution-Non-commercial-Share Alike 3.0License
Contact us
Our Office
Client
Location
Here's how the world's
biggest Grails team is
building enterprise
applications on Grails!
Click Here To Know More!
Have more queries on Grails?
Talk to our GRAILS experts
Now!
Talk To Our Experts

More Related Content

Viewers also liked

Rehearsal schedule final 3 weeks
Rehearsal schedule final 3 weeksRehearsal schedule final 3 weeks
Rehearsal schedule final 3 weeks
sathma
 
gasdj456djkdi3353452
gasdj456djkdi3353452gasdj456djkdi3353452
gasdj456djkdi3353452
cephas3
 
Type1 diabetes psa_storyboard
Type1 diabetes psa_storyboardType1 diabetes psa_storyboard
Type1 diabetes psa_storyboard
Sharon Matney
 
Traditioalnl vs no
Traditioalnl vs noTraditioalnl vs no
Traditioalnl vs no
sathma
 
Open Day Presentation
Open Day Presentation Open Day Presentation
Open Day Presentation
sallyross
 
Pontos para criar_instancia_data guard_11g
Pontos para criar_instancia_data guard_11gPontos para criar_instancia_data guard_11g
Pontos para criar_instancia_data guard_11g
Leandro Santos
 
40 plus presentation
40 plus presentation40 plus presentation
40 plus presentation
Zoe-Ann Lynch
 
Lesson8 presentverbs
Lesson8 presentverbsLesson8 presentverbs
Lesson8 presentverbs
Lauren
 
Historiasexualdelhombre
HistoriasexualdelhombreHistoriasexualdelhombre
Historiasexualdelhombre
Rcabellocaja
 

Viewers also liked (20)

Behavioural Marketing. Connecting the big 4 of web, email, social & mobile
Behavioural Marketing.  Connecting the big 4 of web, email, social & mobile Behavioural Marketing.  Connecting the big 4 of web, email, social & mobile
Behavioural Marketing. Connecting the big 4 of web, email, social & mobile
 
Unit v
Unit vUnit v
Unit v
 
Connecting with users
Connecting with usersConnecting with users
Connecting with users
 
Stop Sending Email! Start Sending Multi-channel messages that matter
Stop Sending Email! Start Sending Multi-channel messages that matterStop Sending Email! Start Sending Multi-channel messages that matter
Stop Sending Email! Start Sending Multi-channel messages that matter
 
Tech Girl Podcasts: What is Web 2.0?
Tech Girl Podcasts: What is Web 2.0?Tech Girl Podcasts: What is Web 2.0?
Tech Girl Podcasts: What is Web 2.0?
 
Rehearsal schedule final 3 weeks
Rehearsal schedule final 3 weeksRehearsal schedule final 3 weeks
Rehearsal schedule final 3 weeks
 
gasdj456djkdi3353452
gasdj456djkdi3353452gasdj456djkdi3353452
gasdj456djkdi3353452
 
Type1 diabetes psa_storyboard
Type1 diabetes psa_storyboardType1 diabetes psa_storyboard
Type1 diabetes psa_storyboard
 
Jeopardy
JeopardyJeopardy
Jeopardy
 
Sivil toplum kuruluşum
Sivil toplum kuruluşumSivil toplum kuruluşum
Sivil toplum kuruluşum
 
State of Search 2013
State of Search 2013State of Search 2013
State of Search 2013
 
Traditioalnl vs no
Traditioalnl vs noTraditioalnl vs no
Traditioalnl vs no
 
FUKUYAMA BASE WORKSHOP Vol17 Theme
FUKUYAMA BASE WORKSHOP Vol17 ThemeFUKUYAMA BASE WORKSHOP Vol17 Theme
FUKUYAMA BASE WORKSHOP Vol17 Theme
 
Open Day Presentation
Open Day Presentation Open Day Presentation
Open Day Presentation
 
Pontos para criar_instancia_data guard_11g
Pontos para criar_instancia_data guard_11gPontos para criar_instancia_data guard_11g
Pontos para criar_instancia_data guard_11g
 
Unicef
UnicefUnicef
Unicef
 
40 plus presentation
40 plus presentation40 plus presentation
40 plus presentation
 
Scambio sul posto dell\'energia
Scambio sul posto dell\'energiaScambio sul posto dell\'energia
Scambio sul posto dell\'energia
 
Lesson8 presentverbs
Lesson8 presentverbsLesson8 presentverbs
Lesson8 presentverbs
 
Historiasexualdelhombre
HistoriasexualdelhombreHistoriasexualdelhombre
Historiasexualdelhombre
 

Similar to Data Binding in Grails

Similar to Data Binding in Grails (20)

Gorm
GormGorm
Gorm
 
Building Your First Serverless Data Lake (ANT356-R1) - AWS re:Invent 2018
Building Your First Serverless Data Lake (ANT356-R1) - AWS re:Invent 2018Building Your First Serverless Data Lake (ANT356-R1) - AWS re:Invent 2018
Building Your First Serverless Data Lake (ANT356-R1) - AWS re:Invent 2018
 
MongoDB-presentation.pptx
MongoDB-presentation.pptxMongoDB-presentation.pptx
MongoDB-presentation.pptx
 
fard car.pptx
fard car.pptxfard car.pptx
fard car.pptx
 
Using Document Databases with TYPO3 Flow
Using Document Databases with TYPO3 FlowUsing Document Databases with TYPO3 Flow
Using Document Databases with TYPO3 Flow
 
Using amazon web services with cold fusion 11
Using amazon web services with cold fusion 11Using amazon web services with cold fusion 11
Using amazon web services with cold fusion 11
 
Deep Dive: Hybrid Cloud Storage with AWS Storage Gateway - AWS Online Tech Talks
Deep Dive: Hybrid Cloud Storage with AWS Storage Gateway - AWS Online Tech TalksDeep Dive: Hybrid Cloud Storage with AWS Storage Gateway - AWS Online Tech Talks
Deep Dive: Hybrid Cloud Storage with AWS Storage Gateway - AWS Online Tech Talks
 
mongo.pptx
mongo.pptxmongo.pptx
mongo.pptx
 
Amazon S3 Masterclass
Amazon S3 MasterclassAmazon S3 Masterclass
Amazon S3 Masterclass
 
Amazon S3 Masterclass
Amazon S3 MasterclassAmazon S3 Masterclass
Amazon S3 Masterclass
 
Mongo db Quick Guide
Mongo db Quick GuideMongo db Quick Guide
Mongo db Quick Guide
 
Alex Casalboni - Configuration management and service discovery - Codemotion ...
Alex Casalboni - Configuration management and service discovery - Codemotion ...Alex Casalboni - Configuration management and service discovery - Codemotion ...
Alex Casalboni - Configuration management and service discovery - Codemotion ...
 
Efficient content structures and queries in CRX/CQ
Efficient content structures and queries in CRX/CQEfficient content structures and queries in CRX/CQ
Efficient content structures and queries in CRX/CQ
 
Saving Data
Saving DataSaving Data
Saving Data
 
DevOps Fest 2019. Alex Casalboni. Configuration management and service discov...
DevOps Fest 2019. Alex Casalboni. Configuration management and service discov...DevOps Fest 2019. Alex Casalboni. Configuration management and service discov...
DevOps Fest 2019. Alex Casalboni. Configuration management and service discov...
 
Infrastructure as code deployed using Stacker
Infrastructure as code deployed using StackerInfrastructure as code deployed using Stacker
Infrastructure as code deployed using Stacker
 
The Ring programming language version 1.5.3 book - Part 83 of 184
The Ring programming language version 1.5.3 book - Part 83 of 184The Ring programming language version 1.5.3 book - Part 83 of 184
The Ring programming language version 1.5.3 book - Part 83 of 184
 
(STG304) Deploying a Disaster Recovery Site on AWS
(STG304) Deploying a Disaster Recovery Site on AWS(STG304) Deploying a Disaster Recovery Site on AWS
(STG304) Deploying a Disaster Recovery Site on AWS
 
GORM
GORMGORM
GORM
 
GORM
GORMGORM
GORM
 

More from TO THE NEW | Technology

10 Pragmatic UX techniques for building smarter products:
10 Pragmatic UX techniques for building smarter products:10 Pragmatic UX techniques for building smarter products:
10 Pragmatic UX techniques for building smarter products:
TO THE NEW | Technology
 
12 Key points which make Swift more effective than Objective C
12 Key points which make Swift more effective than Objective C12 Key points which make Swift more effective than Objective C
12 Key points which make Swift more effective than Objective C
TO THE NEW | Technology
 
AWS CodeDeploy
AWS CodeDeployAWS CodeDeploy
AWS CodeDeploy
TO THE NEW | Technology
 
MongoDb and NoSQL
MongoDb and NoSQLMongoDb and NoSQL
MongoDb and NoSQL
TO THE NEW | Technology
 
(AWS) Auto Scaling : Evening Session by Amazon and IntelliGrape Software
(AWS) Auto Scaling : Evening Session by Amazon and IntelliGrape Software(AWS) Auto Scaling : Evening Session by Amazon and IntelliGrape Software
(AWS) Auto Scaling : Evening Session by Amazon and IntelliGrape Software
TO THE NEW | Technology
 
BigData Search Simplified with ElasticSearch
BigData Search Simplified with ElasticSearchBigData Search Simplified with ElasticSearch
BigData Search Simplified with ElasticSearch
TO THE NEW | Technology
 
Grails Spock Testing
Grails Spock TestingGrails Spock Testing
Grails Spock Testing
TO THE NEW | Technology
 
Introduction to Kanban
Introduction to KanbanIntroduction to Kanban
Introduction to Kanban
TO THE NEW | Technology
 

More from TO THE NEW | Technology (20)

10 Best Node.js Practices you Need to Know!
10 Best Node.js Practices you Need to Know!10 Best Node.js Practices you Need to Know!
10 Best Node.js Practices you Need to Know!
 
10 Pragmatic UX techniques for building smarter products:
10 Pragmatic UX techniques for building smarter products:10 Pragmatic UX techniques for building smarter products:
10 Pragmatic UX techniques for building smarter products:
 
12 Key points which make Swift more effective than Objective C
12 Key points which make Swift more effective than Objective C12 Key points which make Swift more effective than Objective C
12 Key points which make Swift more effective than Objective C
 
Gulp - The Streaming Build System
Gulp - The Streaming Build SystemGulp - The Streaming Build System
Gulp - The Streaming Build System
 
Grails Spring Boot
Grails Spring BootGrails Spring Boot
Grails Spring Boot
 
AWS Elastic Beanstalk
AWS Elastic BeanstalkAWS Elastic Beanstalk
AWS Elastic Beanstalk
 
Content migration to AEM
Content migration to AEMContent migration to AEM
Content migration to AEM
 
AWS CodeDeploy
AWS CodeDeployAWS CodeDeploy
AWS CodeDeploy
 
Big Data Expertise
Big Data ExpertiseBig Data Expertise
Big Data Expertise
 
An introduction to Object Oriented JavaScript
An introduction to Object Oriented JavaScriptAn introduction to Object Oriented JavaScript
An introduction to Object Oriented JavaScript
 
Object Oriented JavaScript - II
Object Oriented JavaScript - IIObject Oriented JavaScript - II
Object Oriented JavaScript - II
 
MongoDb and NoSQL
MongoDb and NoSQLMongoDb and NoSQL
MongoDb and NoSQL
 
(AWS) Auto Scaling : Evening Session by Amazon and IntelliGrape Software
(AWS) Auto Scaling : Evening Session by Amazon and IntelliGrape Software(AWS) Auto Scaling : Evening Session by Amazon and IntelliGrape Software
(AWS) Auto Scaling : Evening Session by Amazon and IntelliGrape Software
 
MongoDB using Grails plugin by puneet behl
MongoDB using Grails plugin by puneet behlMongoDB using Grails plugin by puneet behl
MongoDB using Grails plugin by puneet behl
 
Cloud Formation
Cloud FormationCloud Formation
Cloud Formation
 
BigData Search Simplified with ElasticSearch
BigData Search Simplified with ElasticSearchBigData Search Simplified with ElasticSearch
BigData Search Simplified with ElasticSearch
 
JULY IN GRAILS
JULY IN GRAILSJULY IN GRAILS
JULY IN GRAILS
 
Grails Spock Testing
Grails Spock TestingGrails Spock Testing
Grails Spock Testing
 
Getting groovier-with-vertx
Getting groovier-with-vertxGetting groovier-with-vertx
Getting groovier-with-vertx
 
Introduction to Kanban
Introduction to KanbanIntroduction to Kanban
Introduction to Kanban
 

Recently uploaded

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 

Data Binding in Grails

  • 1.
  • 3. Agenda 1. What is data binding? 2. What arethe possible scenarios? 3. What options does Grails provides for data binding? 4. Security concerns
  • 4. Introduction to AWS CodeDeploy • Single domain classform • Multiple instances of a domain class • Associations • A domain object with file
  • 5. Single Domain Class def save={ def b =new Book() b.properties =params b.save() }
  • 6. Single Domain Class def save={ def b =new Book(params) b.save() } def update ={ def b =Book.get(params.id) b.properties =params b.save() }
  • 7. BindData examples // request parameters to a target object bindData(target,this.params) // exclude firstName and lastName bindData(target,this.params,['firstName', 'lastName']) // only use parameters starting with"author." e.g. author.email bindData(target,this.params, "author")
  • 8. BindData examples // exclude firstName and lastName and only use parameters starting with "author." e.g. author.email bindData(target,this.params,['firstName','lastName'], "author")
  • 9. Binding with Associations class SomeCO{ Date startDate; Date endDate; Project project } <g:datePicker name="startDate"/> <g:datePicker name="startDate"/> <g:select name="project.id" from="${someList}" value="${project?.name}" optionKey="id"/> def myAction{SomeCO someCO -> // perform action }
  • 10. Binding with Associations class Book{ String name Author author } <input type="text" name="book.name" <input type="text" name="author.name" class Author{ Stringname } def b =new Book(params['book']) def a =new Author(params['author'])
  • 11. Binding with Associations <g:form action=”save”> Title:<input type=”text” name=”album.title” /><br> Artist:<input type=”text” name=”artist.name” /><br> Song 1:<input type=”text” name=”songs[0].name”/><br> Song 2:<input type=”text” name=”songs[1].name”/><br> Song 3:<input type=”text” name=”songs[3].name”/><br> </g:form>
  • 12. Addressing Security Concerns Use Special Command Objects Use “excludes” parameter
  • 13. References / Attribution DGG –Second Edition –Chapter4 http://grails.org/Controllers+-+Data+Binding
  • 14. License Thiswork islicensed under the Creative Commons Attribution-Non-commercial-Share Alike 3.0License
  • 15. Contact us Our Office Client Location Here's how the world's biggest Grails team is building enterprise applications on Grails! Click Here To Know More! Have more queries on Grails? Talk to our GRAILS experts Now! Talk To Our Experts