SlideShare a Scribd company logo
1 of 15
developing web applications using Java and the Play framework
What is Play? A clean alternative to the bloated Java Enterprise Edition Pure Java framework – allows you to keep your preferred development tools and libraries Focuses on developer productivity and targets RESTful(Representational State Transfer) architectures Consist of clients and servers Clients initiate requests to servers Servers process requests and return appropriate responses Requests and responses are built around the transfer of representations of resources
The foundation of Play MVC architecture You’ve got a database on one side and a web browser on the other. Classes are models, the application is the controller, generated HTML is the view HTTP-to-code mapping Example: binding URI patterns to Java procedure calls Efficient template engine The expression language used is Groovy Templating system mainly used to render HTML responses
Why is play awesome? Fix the bug and hit reload The framework compiles your Java sources directly and hot-reloads them into the JVM without the need to restart the server You can then edit, reload and see your modifications immediately, just as in a Rails environment Whenever an error occurs, the framework identifies and shows you the problem Stack traces are stripped down and optimized to make it easier to solve problems Java Persistence API (JPA) and The Java Persistence Query Language (JPQL)  A persistence entity is a lightweight Java class saved to a table in a relational database.
JPA, JPQL // Java Persistence API example @Entity  public class Book {  @Id  private Integer id;  private String title;  private String isbn;  	@ManyToOne 	private Publisher publisher;  	@ManyToMany private List<Author> authors;  }
JPA, JPQL // Java Persistence Query Language example public void messages(intpage, User connectedUser) { List<Message> messages = Message.find(“ 	user = ?  	and read = false  	order by date desc",  connectedUser).from(page * 10).fetch(10);  render(connectedUser, messages);  }
Why is play awesome? Test-driven development Run them directly in a browser using Selenium Selenium is a Firefox add-on that records clicks, typing, and other actions Database support through JDBC Object-relational mapping using Hibernate (with the JPA API) Integrated cache support Straightforward web services consumption either in JSON or XML OpenIDsupport for distributed authentication Ready to be deployed anywhere (application server, Google App Engine, Cloud, etc…) Image manipulation API.
Things you can do with play
Things you can do with play Bind an HTTP parameter to a Java method parameter // a simple request /articles/archive?date=08/01/08&page=2 // the Java method public staticvoid archive(Date date, Integer page) {  List<Article> articles = Articles.fromArchive(date, page); render(articles);  }
Things you can do with play Smart binding with any class // a simple model public class Person {  public String name;  public Integer age;  } // a simple controller public static void add(Person p) { 	p.save(); } // a simple HTML form <form action="add" method="POST"> 	Name: <input type="text" name="p.name" />  	Age: <input type="text" name="p.age" />  </form>
Things you can do with play Redirect to an action by calling the corresponding Java method // a simple model with a procedure public static void show(Long id) {  Article article = Article.findById(id);  render(article);  } // use the equivalent syntax: <a href="@{Article.show(article.id)}"> ${article.title} </a>
Things you can do with play Redirect to an action by calling the corresponding Java method (another example) // a simple model with a procedure public static void edit(Long id, String title) {  Article article = Article.findById(id);  article.title= title;  article.save(); show(id);  } // generated HTML: <a href="/articles/15"> My new article </a>
Things you can do with play Straightforward file upload management // the Java code public static void uploadPhoto(String title, File photo) {  	...  } // a simple HTML form <form action="@{Article.uploadPhoto()}" method="POST" 							enctype="multipart/form-data">  	<input type="text" name="title" />  	<input type="file" id="photo" name="photo" />  	<input type="submit" value="Send it..." /> </form>
DEMO Let’s create our own web application:  a personal agenda
Questions?

More Related Content

What's hot

Angular 2 overview
Angular 2 overviewAngular 2 overview
Angular 2 overviewJesse Warden
 
Angularjs interview questions and answers
Angularjs interview questions and answersAngularjs interview questions and answers
Angularjs interview questions and answersAnil Singh
 
Introduction to AngularJS Framework
Introduction to AngularJS FrameworkIntroduction to AngularJS Framework
Introduction to AngularJS FrameworkRaveendra R
 
AngularJS interview questions
AngularJS interview questionsAngularJS interview questions
AngularJS interview questionsUri Lukach
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJSDavid Parsons
 
Step by Step - AngularJS
Step by Step - AngularJSStep by Step - AngularJS
Step by Step - AngularJSInfragistics
 
Angular js
Angular jsAngular js
Angular jsMindtree
 
Angular1x and Angular 2 for Beginners
Angular1x and Angular 2 for BeginnersAngular1x and Angular 2 for Beginners
Angular1x and Angular 2 for BeginnersOswald Campesato
 
Java script performance tips
Java script performance tipsJava script performance tips
Java script performance tipsShakti Shrestha
 
Angular js interview question answer for fresher
Angular js interview question answer for fresherAngular js interview question answer for fresher
Angular js interview question answer for fresherRavi Bhadauria
 
Angular js for beginners
Angular js for beginnersAngular js for beginners
Angular js for beginnersMunir Hoque
 
AngularJS - Architecture decisions in a large project 
AngularJS - Architecture decisionsin a large project AngularJS - Architecture decisionsin a large project 
AngularJS - Architecture decisions in a large project Elad Hirsch
 
AngularJS intro
AngularJS introAngularJS intro
AngularJS introdizabl
 

What's hot (20)

Angular Seminar-js
Angular Seminar-jsAngular Seminar-js
Angular Seminar-js
 
Angular 2 overview
Angular 2 overviewAngular 2 overview
Angular 2 overview
 
AngularJS
AngularJSAngularJS
AngularJS
 
Kickstart sencha extjs
Kickstart sencha extjsKickstart sencha extjs
Kickstart sencha extjs
 
Angularjs interview questions and answers
Angularjs interview questions and answersAngularjs interview questions and answers
Angularjs interview questions and answers
 
Introduction to AngularJS Framework
Introduction to AngularJS FrameworkIntroduction to AngularJS Framework
Introduction to AngularJS Framework
 
Angular JS Introduction
Angular JS IntroductionAngular JS Introduction
Angular JS Introduction
 
AngularJS interview questions
AngularJS interview questionsAngularJS interview questions
AngularJS interview questions
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
Angular Js
Angular JsAngular Js
Angular Js
 
Step by Step - AngularJS
Step by Step - AngularJSStep by Step - AngularJS
Step by Step - AngularJS
 
Angular js
Angular jsAngular js
Angular js
 
Angular1x and Angular 2 for Beginners
Angular1x and Angular 2 for BeginnersAngular1x and Angular 2 for Beginners
Angular1x and Angular 2 for Beginners
 
Java script performance tips
Java script performance tipsJava script performance tips
Java script performance tips
 
Angular js interview question answer for fresher
Angular js interview question answer for fresherAngular js interview question answer for fresher
Angular js interview question answer for fresher
 
Angular js for beginners
Angular js for beginnersAngular js for beginners
Angular js for beginners
 
AngularJS - Architecture decisions in a large project 
AngularJS - Architecture decisionsin a large project AngularJS - Architecture decisionsin a large project 
AngularJS - Architecture decisions in a large project 
 
Angularjs PPT
Angularjs PPTAngularjs PPT
Angularjs PPT
 
AngularJS intro
AngularJS introAngularJS intro
AngularJS intro
 
What's new in Angular 2?
What's new in Angular 2?What's new in Angular 2?
What's new in Angular 2?
 

Similar to Developing web apps using Java and the Play framework

CTS Conference Web 2.0 Tutorial Part 2
CTS Conference Web 2.0 Tutorial Part 2CTS Conference Web 2.0 Tutorial Part 2
CTS Conference Web 2.0 Tutorial Part 2Geoffrey Fox
 
Introduction to JSF
Introduction toJSFIntroduction toJSF
Introduction to JSFSoftServe
 
Java Technology
Java TechnologyJava Technology
Java Technologyifnu bima
 
What is Advance Java J2EE
What is Advance Java J2EEWhat is Advance Java J2EE
What is Advance Java J2EEjavaease
 
Boston Computing Review - Java Server Pages
Boston Computing Review - Java Server PagesBoston Computing Review - Java Server Pages
Boston Computing Review - Java Server PagesJohn Brunswick
 
sMash at May NYPHP UG
sMash at May NYPHP UGsMash at May NYPHP UG
sMash at May NYPHP UGProject Zero
 
ActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group PresentationActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group Presentationipolevoy
 
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitJava Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitIMC Institute
 
Introduction to the Servlet / JSP course
Introduction to the Servlet / JSP course Introduction to the Servlet / JSP course
Introduction to the Servlet / JSP course JavaEE Trainers
 
Google App Engine for Java (GAE/J)
Google App Engine for Java (GAE/J) Google App Engine for Java (GAE/J)
Google App Engine for Java (GAE/J) Lars Vogel
 
JSR 168 Portal - Overview
JSR 168 Portal - OverviewJSR 168 Portal - Overview
JSR 168 Portal - OverviewVinay Kumar
 
Pragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptPragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptdavejohnson
 
eXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework IntroductioneXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework Introductionvstorm83
 

Similar to Developing web apps using Java and the Play framework (20)

CTS Conference Web 2.0 Tutorial Part 2
CTS Conference Web 2.0 Tutorial Part 2CTS Conference Web 2.0 Tutorial Part 2
CTS Conference Web 2.0 Tutorial Part 2
 
Introduction to JSF
Introduction toJSFIntroduction toJSF
Introduction to JSF
 
Java Technology
Java TechnologyJava Technology
Java Technology
 
What is Advance Java J2EE
What is Advance Java J2EEWhat is Advance Java J2EE
What is Advance Java J2EE
 
I Feel Pretty
I Feel PrettyI Feel Pretty
I Feel Pretty
 
Boston Computing Review - Java Server Pages
Boston Computing Review - Java Server PagesBoston Computing Review - Java Server Pages
Boston Computing Review - Java Server Pages
 
Jsp
JspJsp
Jsp
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
 
sMash at May NYPHP UG
sMash at May NYPHP UGsMash at May NYPHP UG
sMash at May NYPHP UG
 
Play framework
Play frameworkPlay framework
Play framework
 
ActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group PresentationActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group Presentation
 
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitJava Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
 
Introduction to the Servlet / JSP course
Introduction to the Servlet / JSP course Introduction to the Servlet / JSP course
Introduction to the Servlet / JSP course
 
Google App Engine for Java (GAE/J)
Google App Engine for Java (GAE/J) Google App Engine for Java (GAE/J)
Google App Engine for Java (GAE/J)
 
Jsp Comparison
 Jsp Comparison Jsp Comparison
Jsp Comparison
 
JSR 168 Portal - Overview
JSR 168 Portal - OverviewJSR 168 Portal - Overview
JSR 168 Portal - Overview
 
Basic Hibernate Final
Basic Hibernate FinalBasic Hibernate Final
Basic Hibernate Final
 
Pragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptPragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScript
 
eXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework IntroductioneXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework Introduction
 
JEE5 New Features
JEE5 New FeaturesJEE5 New Features
JEE5 New Features
 

More from Victor Porof

Firefox WebGL developer tools
Firefox WebGL developer toolsFirefox WebGL developer tools
Firefox WebGL developer toolsVictor Porof
 
Firefox developer tools
Firefox developer toolsFirefox developer tools
Firefox developer toolsVictor Porof
 
Processing.js vs. three.js
Processing.js vs. three.jsProcessing.js vs. three.js
Processing.js vs. three.jsVictor Porof
 
Javascript, Do you speak it!
Javascript, Do you speak it!Javascript, Do you speak it!
Javascript, Do you speak it!Victor Porof
 
Cityquest - Developing games for the mobile devices
Cityquest - Developing games for the mobile devicesCityquest - Developing games for the mobile devices
Cityquest - Developing games for the mobile devicesVictor Porof
 
Web3D - Semantic standards, WebGL, HCI
Web3D - Semantic standards, WebGL, HCIWeb3D - Semantic standards, WebGL, HCI
Web3D - Semantic standards, WebGL, HCIVictor Porof
 
Chameleon game engine
Chameleon game engineChameleon game engine
Chameleon game engineVictor Porof
 
Beginners' guide to Ruby on Rails
Beginners' guide to Ruby on RailsBeginners' guide to Ruby on Rails
Beginners' guide to Ruby on RailsVictor Porof
 
Introduction to the XNA framework
Introduction to the XNA frameworkIntroduction to the XNA framework
Introduction to the XNA frameworkVictor Porof
 
Introduction to 3D and shaders
Introduction to 3D and shadersIntroduction to 3D and shaders
Introduction to 3D and shadersVictor Porof
 

More from Victor Porof (11)

Firefox WebGL developer tools
Firefox WebGL developer toolsFirefox WebGL developer tools
Firefox WebGL developer tools
 
Firefox developer tools
Firefox developer toolsFirefox developer tools
Firefox developer tools
 
Js in the open
Js in the openJs in the open
Js in the open
 
Processing.js vs. three.js
Processing.js vs. three.jsProcessing.js vs. three.js
Processing.js vs. three.js
 
Javascript, Do you speak it!
Javascript, Do you speak it!Javascript, Do you speak it!
Javascript, Do you speak it!
 
Cityquest - Developing games for the mobile devices
Cityquest - Developing games for the mobile devicesCityquest - Developing games for the mobile devices
Cityquest - Developing games for the mobile devices
 
Web3D - Semantic standards, WebGL, HCI
Web3D - Semantic standards, WebGL, HCIWeb3D - Semantic standards, WebGL, HCI
Web3D - Semantic standards, WebGL, HCI
 
Chameleon game engine
Chameleon game engineChameleon game engine
Chameleon game engine
 
Beginners' guide to Ruby on Rails
Beginners' guide to Ruby on RailsBeginners' guide to Ruby on Rails
Beginners' guide to Ruby on Rails
 
Introduction to the XNA framework
Introduction to the XNA frameworkIntroduction to the XNA framework
Introduction to the XNA framework
 
Introduction to 3D and shaders
Introduction to 3D and shadersIntroduction to 3D and shaders
Introduction to 3D and shaders
 

Recently uploaded

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
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.pdfUK Journal
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
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...Drew Madelung
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
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 2024The Digital Insurer
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 

Recently uploaded (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
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
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
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...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
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
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

Developing web apps using Java and the Play framework

  • 1. developing web applications using Java and the Play framework
  • 2. What is Play? A clean alternative to the bloated Java Enterprise Edition Pure Java framework – allows you to keep your preferred development tools and libraries Focuses on developer productivity and targets RESTful(Representational State Transfer) architectures Consist of clients and servers Clients initiate requests to servers Servers process requests and return appropriate responses Requests and responses are built around the transfer of representations of resources
  • 3. The foundation of Play MVC architecture You’ve got a database on one side and a web browser on the other. Classes are models, the application is the controller, generated HTML is the view HTTP-to-code mapping Example: binding URI patterns to Java procedure calls Efficient template engine The expression language used is Groovy Templating system mainly used to render HTML responses
  • 4. Why is play awesome? Fix the bug and hit reload The framework compiles your Java sources directly and hot-reloads them into the JVM without the need to restart the server You can then edit, reload and see your modifications immediately, just as in a Rails environment Whenever an error occurs, the framework identifies and shows you the problem Stack traces are stripped down and optimized to make it easier to solve problems Java Persistence API (JPA) and The Java Persistence Query Language (JPQL)  A persistence entity is a lightweight Java class saved to a table in a relational database.
  • 5. JPA, JPQL // Java Persistence API example @Entity public class Book { @Id private Integer id; private String title; private String isbn; @ManyToOne private Publisher publisher; @ManyToMany private List<Author> authors; }
  • 6. JPA, JPQL // Java Persistence Query Language example public void messages(intpage, User connectedUser) { List<Message> messages = Message.find(“ user = ? and read = false order by date desc", connectedUser).from(page * 10).fetch(10); render(connectedUser, messages); }
  • 7. Why is play awesome? Test-driven development Run them directly in a browser using Selenium Selenium is a Firefox add-on that records clicks, typing, and other actions Database support through JDBC Object-relational mapping using Hibernate (with the JPA API) Integrated cache support Straightforward web services consumption either in JSON or XML OpenIDsupport for distributed authentication Ready to be deployed anywhere (application server, Google App Engine, Cloud, etc…) Image manipulation API.
  • 8. Things you can do with play
  • 9. Things you can do with play Bind an HTTP parameter to a Java method parameter // a simple request /articles/archive?date=08/01/08&page=2 // the Java method public staticvoid archive(Date date, Integer page) { List<Article> articles = Articles.fromArchive(date, page); render(articles); }
  • 10. Things you can do with play Smart binding with any class // a simple model public class Person { public String name; public Integer age; } // a simple controller public static void add(Person p) { p.save(); } // a simple HTML form <form action="add" method="POST"> Name: <input type="text" name="p.name" /> Age: <input type="text" name="p.age" /> </form>
  • 11. Things you can do with play Redirect to an action by calling the corresponding Java method // a simple model with a procedure public static void show(Long id) { Article article = Article.findById(id); render(article); } // use the equivalent syntax: <a href="@{Article.show(article.id)}"> ${article.title} </a>
  • 12. Things you can do with play Redirect to an action by calling the corresponding Java method (another example) // a simple model with a procedure public static void edit(Long id, String title) { Article article = Article.findById(id); article.title= title; article.save(); show(id); } // generated HTML: <a href="/articles/15"> My new article </a>
  • 13. Things you can do with play Straightforward file upload management // the Java code public static void uploadPhoto(String title, File photo) { ... } // a simple HTML form <form action="@{Article.uploadPhoto()}" method="POST" enctype="multipart/form-data"> <input type="text" name="title" /> <input type="file" id="photo" name="photo" /> <input type="submit" value="Send it..." /> </form>
  • 14. DEMO Let’s create our own web application: a personal agenda