SlideShare a Scribd company logo
developing web applications using Java and the Play framework
What is Play?A clean alternative to the bloated Java Enterprise EditionPure Java framework – allows you to keep your preferred development tools and librariesFocuses on developer productivity and targets RESTful(Representational State Transfer) architecturesConsist of clients and serversClients initiate requests to serversServers process requests and return appropriate responsesRequests and responses are built around the transfer of representations of resources
The foundation of PlayMVC architectureYou’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 viewHTTP-to-code mappingExample: binding URI patterns to Java procedure callsEfficient template engineThe expression language used is GroovyTemplating system mainly used to render HTML responses
Why is play awesome?Fix the bug and hit reloadThe framework compiles your Java sources directly and hot-reloads them into the JVM without the need to restart the serverYou can then edit, reload and see your modifications immediately, just as in a Rails environmentWhenever an error occurs, the framework identifies and shows you the problemStack traces are stripped down and optimized to make it easier to solve problemsJava 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; 	@ManyToManyprivate List<Author> authors; }
JPA, JPQL// Java Persistence Query Language examplepublic 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 developmentRun them directly in a browser using SeleniumSelenium is a Firefox add-on that records clicks, typing, and other actionsDatabase support through JDBCObject-relational mapping using Hibernate (with the JPA API)Integrated cache supportStraightforward web services consumption either in JSON or XMLOpenIDsupport for distributed authenticationReady 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 playBind an HTTP parameter to a Java method parameter// a simple request/articles/archive?date=08/01/08&page=2// the Java methodpublic staticvoid archive(Date date, Integer page) { List<Article> articles = Articles.fromArchive(date, page); render(articles); }
Things you can do with playSmart binding with any class// a simple modelpublic class Person { public String name; public Integer age; }// a simple controllerpublic 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 playRedirect to an action by calling the corresponding Java method// a simple model with a procedurepublic 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 playRedirect to an action by calling the corresponding Java method (another example)// a simple model with a procedurepublic 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 playStraightforward file upload management// the Java codepublic 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>
DEMOLet’s create our own web application: a personal agenda
Questions?

More Related Content

ODP
Play with Angular JS
Knoldus Inc.
 
PPTX
Angular JS, A dive to concepts
Abhishek Sur
 
PDF
AngularJS - What is it & Why is it awesome ? (with demos)
Gary Arora
 
PDF
Angular js best practice
Matteo Scandolo
 
PPTX
Introduction to Angular js 2.0
Nagaraju Sangam
 
PDF
AngularJS: Overview & Key Features
Mohamad Al Asmar
 
PDF
Angular 2 interview questions and answers
Anil Singh
 
DOCX
Angular.js interview questions
codeandyou forums
 
Play with Angular JS
Knoldus Inc.
 
Angular JS, A dive to concepts
Abhishek Sur
 
AngularJS - What is it & Why is it awesome ? (with demos)
Gary Arora
 
Angular js best practice
Matteo Scandolo
 
Introduction to Angular js 2.0
Nagaraju Sangam
 
AngularJS: Overview & Key Features
Mohamad Al Asmar
 
Angular 2 interview questions and answers
Anil Singh
 
Angular.js interview questions
codeandyou forums
 

What's hot (20)

PPT
Angular Seminar-js
Mindfire Solutions
 
PDF
Angular 2 overview
Jesse Warden
 
PPTX
Kickstart sencha extjs
Shakti Shrestha
 
PDF
Angularjs interview questions and answers
Anil Singh
 
PPTX
Introduction to AngularJS Framework
Raveendra R
 
PDF
Angular JS Introduction
Dhyego Fernando
 
PDF
AngularJS interview questions
Uri Lukach
 
PPTX
Introduction to AngularJS
David Parsons
 
PPTX
Angular Js
Knoldus Inc.
 
PPTX
Step by Step - AngularJS
Infragistics
 
PPTX
Angular js
Mindtree
 
PPTX
Angular1x and Angular 2 for Beginners
Oswald Campesato
 
PPTX
Java script performance tips
Shakti Shrestha
 
PDF
Angular js interview question answer for fresher
Ravi Bhadauria
 
PPTX
Angular js for beginners
Munir Hoque
 
PPTX
AngularJS - Architecture decisions in a large project 
Elad Hirsch
 
PPTX
Angularjs PPT
Amit Baghel
 
PPTX
AngularJS intro
dizabl
 
PPTX
What's new in Angular 2?
Alfred Jett Grandeza
 
Angular Seminar-js
Mindfire Solutions
 
Angular 2 overview
Jesse Warden
 
Kickstart sencha extjs
Shakti Shrestha
 
Angularjs interview questions and answers
Anil Singh
 
Introduction to AngularJS Framework
Raveendra R
 
Angular JS Introduction
Dhyego Fernando
 
AngularJS interview questions
Uri Lukach
 
Introduction to AngularJS
David Parsons
 
Angular Js
Knoldus Inc.
 
Step by Step - AngularJS
Infragistics
 
Angular js
Mindtree
 
Angular1x and Angular 2 for Beginners
Oswald Campesato
 
Java script performance tips
Shakti Shrestha
 
Angular js interview question answer for fresher
Ravi Bhadauria
 
Angular js for beginners
Munir Hoque
 
AngularJS - Architecture decisions in a large project 
Elad Hirsch
 
Angularjs PPT
Amit Baghel
 
AngularJS intro
dizabl
 
What's new in Angular 2?
Alfred Jett Grandeza
 
Ad

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

ODP
eXo Platform SEA - Play Framework Introduction
vstorm83
 
PPTX
How to Play at Work - A Play Framework Tutorial
AssistSoftware
 
PDF
Play Framework Introduction
m-kurz
 
PDF
Having Fun with Play
Clinton Dreisbach
 
PPTX
Play! Framework for JavaEE Developers
Teng Shiu Huang
 
PDF
Play framework productivity formula
Sorin Chiprian
 
PPT
Intoduction to Play Framework
Knoldus Inc.
 
KEY
Play Support in Cloud Foundry
rajdeep
 
PDF
Web application development using Play Framework (with Java)
Saeed Zarinfam
 
PPTX
Silicon Valley Code Camp 2011: Play! as you REST
Manish Pandit
 
PDF
Play Framework: Intro & High-Level Overview
Josh Padnick
 
PDF
Play 2.0
elizhender
 
PDF
Play Framework
Harinath Krishnamoorthy
 
PPT
Introduction to Play Framework
Warren Zhou
 
PDF
An Introduction to Play 2 Framework
PT.JUG
 
PDF
Using Play Framework 2 in production
Christian Papauschek
 
PDF
Play Framework workshop: full stack java web app
Andrew Skiba
 
PDF
Dive into Play Framework
Maher Gamal
 
PDF
Introduction in the play framework
Alexander Reelsen
 
PDF
Play framework
Keshaw Kumar
 
eXo Platform SEA - Play Framework Introduction
vstorm83
 
How to Play at Work - A Play Framework Tutorial
AssistSoftware
 
Play Framework Introduction
m-kurz
 
Having Fun with Play
Clinton Dreisbach
 
Play! Framework for JavaEE Developers
Teng Shiu Huang
 
Play framework productivity formula
Sorin Chiprian
 
Intoduction to Play Framework
Knoldus Inc.
 
Play Support in Cloud Foundry
rajdeep
 
Web application development using Play Framework (with Java)
Saeed Zarinfam
 
Silicon Valley Code Camp 2011: Play! as you REST
Manish Pandit
 
Play Framework: Intro & High-Level Overview
Josh Padnick
 
Play 2.0
elizhender
 
Play Framework
Harinath Krishnamoorthy
 
Introduction to Play Framework
Warren Zhou
 
An Introduction to Play 2 Framework
PT.JUG
 
Using Play Framework 2 in production
Christian Papauschek
 
Play Framework workshop: full stack java web app
Andrew Skiba
 
Dive into Play Framework
Maher Gamal
 
Introduction in the play framework
Alexander Reelsen
 
Play framework
Keshaw Kumar
 
Ad

More from Victor Porof (11)

PDF
Firefox WebGL developer tools
Victor Porof
 
PDF
Firefox developer tools
Victor Porof
 
PDF
Js in the open
Victor Porof
 
PDF
Processing.js vs. three.js
Victor Porof
 
PDF
Javascript, Do you speak it!
Victor Porof
 
PDF
Cityquest - Developing games for the mobile devices
Victor Porof
 
PDF
Web3D - Semantic standards, WebGL, HCI
Victor Porof
 
PDF
Chameleon game engine
Victor Porof
 
PPTX
Beginners' guide to Ruby on Rails
Victor Porof
 
PPTX
Introduction to the XNA framework
Victor Porof
 
PPT
Introduction to 3D and shaders
Victor Porof
 
Firefox WebGL developer tools
Victor Porof
 
Firefox developer tools
Victor Porof
 
Js in the open
Victor Porof
 
Processing.js vs. three.js
Victor Porof
 
Javascript, Do you speak it!
Victor Porof
 
Cityquest - Developing games for the mobile devices
Victor Porof
 
Web3D - Semantic standards, WebGL, HCI
Victor Porof
 
Chameleon game engine
Victor Porof
 
Beginners' guide to Ruby on Rails
Victor Porof
 
Introduction to the XNA framework
Victor Porof
 
Introduction to 3D and shaders
Victor Porof
 

Recently uploaded (20)

PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PDF
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PPTX
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PDF
BLW VOCATIONAL TRAINING SUMMER INTERNSHIP REPORT
codernjn73
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
REPORT: Heating appliances market in Poland 2024
SPIUG
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
PPTX
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
PDF
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
BLW VOCATIONAL TRAINING SUMMER INTERNSHIP REPORT
codernjn73
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
REPORT: Heating appliances market in Poland 2024
SPIUG
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 

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 EditionPure Java framework – allows you to keep your preferred development tools and librariesFocuses on developer productivity and targets RESTful(Representational State Transfer) architecturesConsist of clients and serversClients initiate requests to serversServers process requests and return appropriate responsesRequests and responses are built around the transfer of representations of resources
  • 3. The foundation of PlayMVC architectureYou’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 viewHTTP-to-code mappingExample: binding URI patterns to Java procedure callsEfficient template engineThe expression language used is GroovyTemplating system mainly used to render HTML responses
  • 4. Why is play awesome?Fix the bug and hit reloadThe framework compiles your Java sources directly and hot-reloads them into the JVM without the need to restart the serverYou can then edit, reload and see your modifications immediately, just as in a Rails environmentWhenever an error occurs, the framework identifies and shows you the problemStack traces are stripped down and optimized to make it easier to solve problemsJava 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; @ManyToManyprivate List<Author> authors; }
  • 6. JPA, JPQL// Java Persistence Query Language examplepublic 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 developmentRun them directly in a browser using SeleniumSelenium is a Firefox add-on that records clicks, typing, and other actionsDatabase support through JDBCObject-relational mapping using Hibernate (with the JPA API)Integrated cache supportStraightforward web services consumption either in JSON or XMLOpenIDsupport for distributed authenticationReady 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 playBind an HTTP parameter to a Java method parameter// a simple request/articles/archive?date=08/01/08&page=2// the Java methodpublic staticvoid archive(Date date, Integer page) { List<Article> articles = Articles.fromArchive(date, page); render(articles); }
  • 10. Things you can do with playSmart binding with any class// a simple modelpublic class Person { public String name; public Integer age; }// a simple controllerpublic 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 playRedirect to an action by calling the corresponding Java method// a simple model with a procedurepublic 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 playRedirect to an action by calling the corresponding Java method (another example)// a simple model with a procedurepublic 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 playStraightforward file upload management// the Java codepublic 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. DEMOLet’s create our own web application: a personal agenda