Your SlideShare is downloading. ×
0
Dive into Play Framework
Dive into Play Framework
Dive into Play Framework
Dive into Play Framework
Dive into Play Framework
Dive into Play Framework
Dive into Play Framework
Dive into Play Framework
Dive into Play Framework
Dive into Play Framework
Dive into Play Framework
Dive into Play Framework
Dive into Play Framework
Dive into Play Framework
Dive into Play Framework
Dive into Play Framework
Dive into Play Framework
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Dive into Play Framework

1,698

Published on

A quick talk that was given during 2010 about the main features of Play! framework. …

A quick talk that was given during 2010 about the main features of Play! framework.

This was given to the development team at Evoolv, which has kickstarted the web development over Play! framework which turned out was a decent choice.

Published in: Technology, Education
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,698
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
28
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  1. Dive into Framework Maher Gamal
  2. Key Features● Agile development workflow ( Save, Reload ! )● Stateless architecture● Clear error reporting● Reusable modules & plugins● Gets you up and running quickly !
  3. Project Layout : play new proj1● proj1/app/controllers● proj1/app/models● proj1/app/views● proj1/conf/application.conf● proj1/conf/messages● proj1/conf/routes● proj1/lib● proj1/public● proj1/test
  4. Routing : /conf/routes ● ExamplesGET /profile/view/{id} ProfileController.viewPOST /profile/save ProfileController.saveGET /{<ar|en>lang}/ HomeController.index* /{controller}/{action} {controller}.{action} ● Defining the URLs early, forces you to explore your website ● You can use annotations too (with the play-router module)
  5. Controllers : /app/controllersimport play.mvc.Controller;public class ProfileController extends Controller { public static void view(Long id) { // ... renderText("123"); // or json, xml. renderTemplate("Users/show.html"); redirect("...."); HomeController.index(); // Does a redirect // ... }}
  6. Models : /app/modelsimport play.db.jpa.Model;import javax.persistence.Entity;@Entitypublic class User extends Model { public String email; public String password;}
  7. Validations : /app/modelsimport play.db.jpa.Model;import javax.persistence.Entity;import play.data.validation.*;@Entitypublic class User extends Model { @Email @Required public String email; @Required @MinSize(5) public String password;}
  8. Validations : /app/controllersimport play.mvc.Controller;public class ProfileController extends Controller { public static void view(@Valid Profile profile) { render(profile); // or invoke the validation manually ! // validation.valid(profile) }}
  9. Views : /app/views/app/views/ProfileController/view.html#{ifErrors} <ul class="error"> #{errors} <li>${error}</li> #{/errors} </ul>#{/ifErrors}
  10. Views : /app/views/app/views/ProfileController/view.html#{extends main.html /}#{set title : Page Title /}#{set moreScripts} ...#{/set}/app/views/main.html<html> <head> <title>#{get title /}</title> #{get moreScripts /} </head></html>
  11. Views : /app/views/app/views/main.html<html> <head> <title>#{get title /}</title> #{get moreScripts /} </head> <body> ... #{doLayout /} ... </body></html>
  12. Jobs : /app/jobspublic class BootstrapJob extends Job { @Override public void doJob() { ... }}
  13. Jobs : /app/jobs@OnApplicationStartpublic class BootstrapJob extends Job { @Override public void doJob() { ... }}
  14. Jobs : /app/jobs@Every("1h") or @On("0 0 * * *")public class BootstrapJob extends Job { @Override public void doJob() { ... }}
  15. Helper Libraries : play.libs.* ● MD5 , SHA1 , Base64 Encoding/Decoding ● Encryption , decryption , hashing ● File/Directory copying , deleting and I/O methods ● Image resizing , cropping and captcha generation ● Mail message preparation and sending ● OAuth Integration ● OpenID Integration ● HttpClient to call external web services ● XML Parsing
  16. Running● play new proj1● play run proj1● play clean,run proj1● play netbeansify proj1● play help
  17. Resources● Documentation ○ playframework.org/documentation ○ playframework.org/documentation/api/1.1.1/index.html● Community ○ playframework.org/community ○ play.lighthouseapp.com ○ groups.google.com/group/play-framework● Modules and Examples ○ playframework.org/modules ○ Check samples-and-tests directory in the release

×