SlideShare a Scribd company logo
PrimeFaces
Next Generation Component Suite




         Cagatay Civici
Cagatay Civici
• JSF Expert Group Member (JSR-314)
• PrimeFaces Founder and Lead
• Apache MyFaces PMC Member
• Atmosphere Ajax Push/Comet
  Committer
• Regular Speaker, Author, Technical
  Reviewer
• Co-founder of Prime Technology
Prime Technology
• Agile and Java EE Consulting
• JSF, Spring, Seam, JPA
• Trainings (e.g. PrimeFaces, JSF 2.0)
• Outsource Development
• Istanbul/Turkey based
What is this about?
• PrimeFaces Component Suite
• RIA
• Ajax Push
• TouchFaces
• iPhone/Android/Palm
• GPS Navigation
• Mock OS X with JSF
• Interested?
PrimeFaces
• Next Generation Component Suite




• Designed with JSF 2.0 in mind
History
• 1+ year old
• November 2008 - Start
• January 2009 - First Release 0.8.0
• 10 releases so far
• February 2010 - 1.0.0 and 2.0.0
1.0.0 and 2.0.0
Design Principles
• A good UI component should hide
  complexity but must keep flexibility
• Page author must be in full control
• Do not overuse JSF extensions
• Avoid extensions that can cause race
  conditions
• Avoid bringing overhead, keep it clean!
UI Components
• 70+ Rich set of components
• Ajax powered or Client side
• YUI, jQuery and PrimeFaces widgets
• Unobstrusive Javascript
• Customizable and Easy to Use
• Compatible with “others”
• Skinning
Extreme UI with PrimeFaces
Simple Setup
   JSF 1.2                 JSF 2.0
• ResourceServlet   • ResourceServlet (Opt)
• p:resources       • Taglib
• Taglib            • Ready!
• Ready!
ResourceServlet
• Streaming and Caching (js, css, images)
• Auto-Registered in Servlet 3.0 Environment

 <servlet>
  <servlet-name>Resource Servlet</servlet-name>
  <servlet-class>org.primefaces.resource.ResourceServlet</servlet>
</servlet>

<servlet-mapping>
  <servlet-name>Resource Servlet</servlet-name>
  <url-pattern>/primefaces_resource/*</url-pattern>
 </servlet-mapping>
p:resources for JSF 1.2

• Renders <link />, <script />
• No hacks to head
• Not required in JSF 2.0 -> <h:head />

  <head>
   <p:resources />
  </head>
Ready!
 <html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui">

<h:head>
!
</h:head>

<h:body>

!     <p:editor />

<h:body>

    </html>
Unobstrusive UI
                      JSF Markup
<p:schedule id=”calendar ” value=”#{bean.value}” editable=”true”/>




                     HTML Markup

<div id=”calendar”></div>

<script type=”text/javascript”>
  new PrimeFaces.widget.Schedule(‘calendar’, {editable:true});
</script>
Output
Easy Ajax
• Ajax without complexity
• Partial Page Rendering
• Flexible with Callbacks (e.g. onstart,
  oncomplete)
• Ajax components (e.g. autoComplete)
• Lightweight, No overhead
PPR - Hello World
public class GreetingBean {
  private String name;
  //...
}



<h:form>
   <h:inputText value=”#{greetingBean.name}” />
   <h:outputText id=”name” value=”Hi: #{greetingBean.name}” />

   <p:commandButton value=”Ajax Submit” update=”name”/>
</h:form>
p:ajax
• f:ajax extension
 <h:inputText value=”#{greetingBean.name}”>
    <p:ajax event=”blur” update=”name” />
 </h:inputText>

 <h:outputText id=”name” value=”Hi: #{greetingBean.name}” />
Defining Ids
• Server id                   update=”text”

• Client id                 update=”form:text”

• Comma separated          update=”text,panel”

• White space separated    update=”text panel”

• Mix                     update=”form:text grid”

• Keywords                   update=”@form”
Keywords
• @this         update=”@parent”
• @parent
• @form
• @all
• @none
Partial Processing
• Decide what to process
• process attribute
• Ajax requests
• Non-ajax requests

          process=”@this”
Partial Processing - Case 1

<h:form>
   <h:inputText id=”iamrequired” required=”true” />

  <h:selectOneMenu id=”cities”>
     <p:ajax update=”cities” process=”@this” />
  </h:selectOneMenu>

   <h:selectOneMenu id=”suburbs” />
</h:form>
Partial Processing - Case 2
<h:form>
 <h:inputText id=”iamrequired” required=”true” />

  <h:outputText id=”selected” />

  <p:dataTable id=”table”>
      <p:column>
         <p:commandLink update=”selected” process=”table” />
      </p:column>
  </p:dataTable>
</h:form>
Partial Processing - Case 3
<h:form>
  <h:inputText id=”iamrequired” required=”true” />

   <h:commandButton action=”navigate” immediate=”true” />
</h:form>



• Making immediate obsolete
<h:form>
  <h:inputText id=”iamrequired” required=”true” />

   <p:commandButton action=”navigate” process=”@this” />
</h:form>
Process vs Update
                      Restore View

                     Apply Request

Process               Validations

                     Update Model

                      Invoke App

Update                  Render
Notifying Users
• Declarative
   <p:ajaxStatus>
  ! ! <f:facet name="start">
  ! ! ! <p:graphicImage value="fancyanimation.gif" />
  ! ! </f:facet>! !
  ! ! <f:facet name="complete">
  ! ! ! <h:outputText value="Request Completed" />
  ! ! </f:facet>
   </p:ajaxStatus>

• Programmatic
  <p:ajaxStatus onstart=”alert(‘Started’)” oncomplete=”alert(‘done’)” />
Global vs Non-Global
• To trigger p:ajaxStatus or not
   <p:ajaxStatus>
  ! ! <f:facet name="start">
  ! ! ! <p:graphicImage value="fancyanimation.gif" />
  ! ! </f:facet>! !
  ! ! <f:facet name="complete">
  ! ! ! <h:outputText value="Request Completed" />
  ! ! </f:facet>
   </p:ajaxStatus>

• Global (Default)           <p:commandButton value=”Submit” /

• Silent        <p:commandButton value=”Submit” global=”false” /
Component specific
           callbacks
   • onstart
   • onsuccess
   • oncomplete
   • onerror

<p:commandButton onstart=”return confirm(‘Sure’)”
            oncomplete=”alert(‘Done’);” />
Callback Arguments
<p:commandButton value=”Submit” action=”#{bean.save}”
 oncomplete=”handleComplete(xhr, status, args)” />

 public void save() {
   RequestContext context = RequestContext.getCurrentInstance();
   context.addCallbackParam(“item”, item);
 }

 • From backing bean to ajax callbacks with
   JSON
 <script type=”text/javascript”>
 function handleComplete(xhr, status, args) {
    alert(args.item.name);
 }
 </script>
Ajax Remoting
public class GreetingBean {
  private String name;
  //...
  public void toUpperCase() {
      name = name.toUpperCase();
  }
}

 • p:remoteCommand
<p:remoteCommand name=”upperCase”
   actionListener=#{greetingBean.toUppterCase} />


<script type=”text/javascript”>
  upperCase();
</script>
PPR Summary
                  No Need For
• Simple
                  Ajax Servlet Filter
• Easy to Use
                     Html Parser
• Flexible
• Responsive      Ajax ViewHandler

• Lightweight     Ajax StateManager

• Keep it clean     Ajax Regions


                        Ajax*
Component Suite Demo
TouchFaces
• Mobile UI Kit
• WebKit Browsers
• IPhone, Android, Palm
• Native IPhone UI
• Integrated Ajax
• Regular JSF
• Powered by jqTouch
TouchFaces UI
• <i:application />
• <i:view />
• <i:tableView />
• <i:rowGroup />
• <i:rowItem />
• <i:switch />
TouchFaces in Action



Translate             Chat - Ajax Push       PathFinder - GPS          TwitFaces




            Weather                  Notes                      News
TouchFaces Demo
Ajax Push/Comet
• Built on top of Atmosphere
• <p:push />
• CometContext.publish(...)
Atmosphere Framework
• Portable Comet Framework
• Write Once, Deploy Anywhere
• Rest support
• Servlet 3.0 support
• JSF Integration: PrimeFaces
Ajax Push/Comet
Chat App in a Minute
    public class ChatController {

      private String message;

      public void send(ActionEvent event) {
           CometContext.publish(“chat”, message);
      }
      //getters setters
}

  <h:form>
    <h:inputText value=”#{chatController.message}” />
    <p:commandButton value=”Send” actionListener=”#{chatController.send}” />
</h:form>
<p:outputPanel id=”display” />

<p:push channel=”chat” onpublish=”handlePublish” />

<script type=”text/javascript”>
function handlePublish(pushed) {
! $('#display').append(pushed.data);
}
</script>
Pushing as JSON
Player player = new Player();
 player.setName(“Messi”);
 player.setAge(22);

CometContext.publish(player);




function handlePublish(pushed) {
   //pushed.data.name;
   //pushed.data.age;
}
Extensions: FacesTrace
• Trace/Debug tool
• Lifecycle visualizer
• Performance Tracker
• Visual component tree
FacesTrace Demo
Integrate With
• Spring
• Spring Webflow
• Seam
• CDI
• Portlets
• See svn/examples
Documentation
• User’s Guide - 350 pages
• Wiki
• Screencasts
• API & TLD Docs
• Third party articles/blogs
Community Support
• http://primefaces.prime.com.tr/forum
Enterprise Support
• 2/4 hour average response time
• Priority forum access
• Ticket based portal
• IM support over skype
• JSF specific help
• Special Case Support
Community
• Strong community feedback
• 500 posts per week in forum
• Join us!
Coming Soon
TreeTable                 ContextMenu




            ProgressBar




            and more.......
Finale
• cagatay.civici@prime.com.tr
• Twitter: @cagataycivici, @primefaces
• Facebook Group: 206606616332
• Blog: http://cagataycivici.wordpress.com
• HomePage: http://www.primefaces.org
• Atmosphere: http://atmosphere.dev.java.net
Questions

More Related Content

PDF
PrimeTime JSF with PrimeFaces - Dec 2014
PDF
Primefaces Confess 2012
PDF
In The Brain of Cagatay Civici: Exploring JavaServer Faces 2.0 and PrimeFaces
TXT
Xml sitemap content 500 pages
PDF
BPM-2 Introduction to Advanced Workflows
PDF
BPM-1 Introduction to Advanced Workflows
PDF
BPM-3 Advanced Workflow Deep Dive
PDF
Velocity EU 2014 — Offline-first web apps
PrimeTime JSF with PrimeFaces - Dec 2014
Primefaces Confess 2012
In The Brain of Cagatay Civici: Exploring JavaServer Faces 2.0 and PrimeFaces
Xml sitemap content 500 pages
BPM-2 Introduction to Advanced Workflows
BPM-1 Introduction to Advanced Workflows
BPM-3 Advanced Workflow Deep Dive
Velocity EU 2014 — Offline-first web apps

What's hot (20)

KEY
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
PDF
In The Trenches With Tomster, Upgrading Ember.js & Ember Data
PDF
Introduction to AngularJS For WordPress Developers
PDF
Unobtrusive JavaScript
PPTX
Oracle APEX Performance
PPTX
Angular Tutorial Freshers and Experienced
PPTX
How to Build SPA with Vue Router 2.0
PDF
Refactoring Large Web Applications with Backbone.js
PDF
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
KEY
Making WordPress Your CMS and Automatically Updating a Self Hosted WordPress ...
PDF
Future of Web Apps: Google Gears
PPTX
Laravel - Website Development in Php Framework.
PDF
Applications: A Series of States
PPTX
Ruby on Rails + AngularJS + Twitter Bootstrap
KEY
Really Rapid Admin Application Development
PDF
Jlook web ui framework
PDF
AtlasCamp 2010: Making Confluence Macros Easy (for the user) - Dave Taylor
PDF
Testing Ember Apps: Managing Dependency
PDF
Ajax Rails
 
PDF
Breaking SAP portal (HashDays)
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
In The Trenches With Tomster, Upgrading Ember.js & Ember Data
Introduction to AngularJS For WordPress Developers
Unobtrusive JavaScript
Oracle APEX Performance
Angular Tutorial Freshers and Experienced
How to Build SPA with Vue Router 2.0
Refactoring Large Web Applications with Backbone.js
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Making WordPress Your CMS and Automatically Updating a Self Hosted WordPress ...
Future of Web Apps: Google Gears
Laravel - Website Development in Php Framework.
Applications: A Series of States
Ruby on Rails + AngularJS + Twitter Bootstrap
Really Rapid Admin Application Development
Jlook web ui framework
AtlasCamp 2010: Making Confluence Macros Easy (for the user) - Dave Taylor
Testing Ember Apps: Managing Dependency
Ajax Rails
 
Breaking SAP portal (HashDays)
Ad

Similar to Primefaces Nextgen Lju (20)

PDF
AnkaraJUG Kasım 2012 - PrimeFaces
PDF
PrimeFaces: Next-Generation JSF Component Suite - Ian Hlavats
PDF
A Peek At The Future: Going Beyond JavaServer Faces 2.0 With RichFaces 4
PDF
What You Need To Build Cool Enterprise Applications With JSF
PDF
Going Above JSF 2.0 with RichFaces and Seam
PPTX
User Interface Patterns and Nuxeo
PDF
JSF 2.0 Preview
PDF
RichFaces 4 Component Deep Dive - JAX/JSFSummit
PPTX
PDF
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0
PDF
Java Web Programming [8/9] : JSF and AJAX
PPT
JSF 2 and beyond: Keeping progress coming
PPTX
JSF 2: Myth of panacea? Magic world of user interfaces
PDF
JavaServer Faces 2.0 - JavaOne India 2011
PDF
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
PDF
Java EE7 Demystified
PDF
Ajax Applications with JSF 2 and new RichFaces 4 - Herbstcampus
PDF
RichFaces 4: Rich Ajax Components For Your JSF Applications
PDF
Prototype-1
PDF
Prototype-1
AnkaraJUG Kasım 2012 - PrimeFaces
PrimeFaces: Next-Generation JSF Component Suite - Ian Hlavats
A Peek At The Future: Going Beyond JavaServer Faces 2.0 With RichFaces 4
What You Need To Build Cool Enterprise Applications With JSF
Going Above JSF 2.0 with RichFaces and Seam
User Interface Patterns and Nuxeo
JSF 2.0 Preview
RichFaces 4 Component Deep Dive - JAX/JSFSummit
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0
Java Web Programming [8/9] : JSF and AJAX
JSF 2 and beyond: Keeping progress coming
JSF 2: Myth of panacea? Magic world of user interfaces
JavaServer Faces 2.0 - JavaOne India 2011
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
Java EE7 Demystified
Ajax Applications with JSF 2 and new RichFaces 4 - Herbstcampus
RichFaces 4: Rich Ajax Components For Your JSF Applications
Prototype-1
Prototype-1
Ad

More from Skills Matter (20)

PDF
5 things cucumber is bad at by Richard Lawrence
ODP
Patterns for slick database applications
PDF
Scala e xchange 2013 haoyi li on metascala a tiny diy jvm
ODP
Oscar reiken jr on our success at manheim
ODP
Progressive f# tutorials nyc dmitry mozorov & jack pappas on code quotations ...
PDF
Cukeup nyc ian dees on elixir, erlang, and cucumberl
PDF
Cukeup nyc peter bell on getting started with cucumber.js
PDF
Agile testing & bdd e xchange nyc 2013 jeffrey davidson & lav pathak & sam ho...
ODP
Progressive f# tutorials nyc rachel reese & phil trelford on try f# from zero...
ODP
Progressive f# tutorials nyc don syme on keynote f# in the open source world
PDF
Agile testing & bdd e xchange nyc 2013 gojko adzic on bond villain guide to s...
PPTX
Dmitry mozorov on code quotations code as-data for f#
PDF
A poet's guide_to_acceptance_testing
PDF
Russ miles-cloudfoundry-deep-dive
KEY
Serendipity-neo4j
PDF
Simon Peyton Jones: Managing parallelism
PDF
Plug 20110217
PDF
Lug presentation
PPT
I went to_a_communications_workshop_and_they_t
PDF
Plug saiku
5 things cucumber is bad at by Richard Lawrence
Patterns for slick database applications
Scala e xchange 2013 haoyi li on metascala a tiny diy jvm
Oscar reiken jr on our success at manheim
Progressive f# tutorials nyc dmitry mozorov & jack pappas on code quotations ...
Cukeup nyc ian dees on elixir, erlang, and cucumberl
Cukeup nyc peter bell on getting started with cucumber.js
Agile testing & bdd e xchange nyc 2013 jeffrey davidson & lav pathak & sam ho...
Progressive f# tutorials nyc rachel reese & phil trelford on try f# from zero...
Progressive f# tutorials nyc don syme on keynote f# in the open source world
Agile testing & bdd e xchange nyc 2013 gojko adzic on bond villain guide to s...
Dmitry mozorov on code quotations code as-data for f#
A poet's guide_to_acceptance_testing
Russ miles-cloudfoundry-deep-dive
Serendipity-neo4j
Simon Peyton Jones: Managing parallelism
Plug 20110217
Lug presentation
I went to_a_communications_workshop_and_they_t
Plug saiku

Recently uploaded (20)

PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
WOOl fibre morphology and structure.pdf for textiles
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
A Presentation on Artificial Intelligence
PDF
1 - Historical Antecedents, Social Consideration.pdf
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
Web App vs Mobile App What Should You Build First.pdf
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
A comparative analysis of optical character recognition models for extracting...
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
TLE Review Electricity (Electricity).pptx
PDF
Approach and Philosophy of On baking technology
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
A novel scalable deep ensemble learning framework for big data classification...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
WOOl fibre morphology and structure.pdf for textiles
Unlocking AI with Model Context Protocol (MCP)
A Presentation on Artificial Intelligence
1 - Historical Antecedents, Social Consideration.pdf
Group 1 Presentation -Planning and Decision Making .pptx
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Web App vs Mobile App What Should You Build First.pdf
gpt5_lecture_notes_comprehensive_20250812015547.pdf
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
A comparative analysis of optical character recognition models for extracting...
Programs and apps: productivity, graphics, security and other tools
MIND Revenue Release Quarter 2 2025 Press Release
TLE Review Electricity (Electricity).pptx
Approach and Philosophy of On baking technology
Digital-Transformation-Roadmap-for-Companies.pptx
SOPHOS-XG Firewall Administrator PPT.pptx
A novel scalable deep ensemble learning framework for big data classification...

Primefaces Nextgen Lju

  • 2. Cagatay Civici • JSF Expert Group Member (JSR-314) • PrimeFaces Founder and Lead • Apache MyFaces PMC Member • Atmosphere Ajax Push/Comet Committer • Regular Speaker, Author, Technical Reviewer • Co-founder of Prime Technology
  • 3. Prime Technology • Agile and Java EE Consulting • JSF, Spring, Seam, JPA • Trainings (e.g. PrimeFaces, JSF 2.0) • Outsource Development • Istanbul/Turkey based
  • 4. What is this about? • PrimeFaces Component Suite • RIA • Ajax Push • TouchFaces • iPhone/Android/Palm • GPS Navigation • Mock OS X with JSF • Interested?
  • 5. PrimeFaces • Next Generation Component Suite • Designed with JSF 2.0 in mind
  • 6. History • 1+ year old • November 2008 - Start • January 2009 - First Release 0.8.0 • 10 releases so far • February 2010 - 1.0.0 and 2.0.0
  • 8. Design Principles • A good UI component should hide complexity but must keep flexibility • Page author must be in full control • Do not overuse JSF extensions • Avoid extensions that can cause race conditions • Avoid bringing overhead, keep it clean!
  • 9. UI Components • 70+ Rich set of components • Ajax powered or Client side • YUI, jQuery and PrimeFaces widgets • Unobstrusive Javascript • Customizable and Easy to Use • Compatible with “others” • Skinning
  • 10. Extreme UI with PrimeFaces
  • 11. Simple Setup JSF 1.2 JSF 2.0 • ResourceServlet • ResourceServlet (Opt) • p:resources • Taglib • Taglib • Ready! • Ready!
  • 12. ResourceServlet • Streaming and Caching (js, css, images) • Auto-Registered in Servlet 3.0 Environment <servlet> <servlet-name>Resource Servlet</servlet-name> <servlet-class>org.primefaces.resource.ResourceServlet</servlet> </servlet> <servlet-mapping> <servlet-name>Resource Servlet</servlet-name> <url-pattern>/primefaces_resource/*</url-pattern> </servlet-mapping>
  • 13. p:resources for JSF 1.2 • Renders <link />, <script /> • No hacks to head • Not required in JSF 2.0 -> <h:head /> <head> <p:resources /> </head>
  • 15. Unobstrusive UI JSF Markup <p:schedule id=”calendar ” value=”#{bean.value}” editable=”true”/> HTML Markup <div id=”calendar”></div> <script type=”text/javascript”> new PrimeFaces.widget.Schedule(‘calendar’, {editable:true}); </script>
  • 17. Easy Ajax • Ajax without complexity • Partial Page Rendering • Flexible with Callbacks (e.g. onstart, oncomplete) • Ajax components (e.g. autoComplete) • Lightweight, No overhead
  • 18. PPR - Hello World public class GreetingBean { private String name; //... } <h:form> <h:inputText value=”#{greetingBean.name}” /> <h:outputText id=”name” value=”Hi: #{greetingBean.name}” /> <p:commandButton value=”Ajax Submit” update=”name”/> </h:form>
  • 19. p:ajax • f:ajax extension <h:inputText value=”#{greetingBean.name}”> <p:ajax event=”blur” update=”name” /> </h:inputText> <h:outputText id=”name” value=”Hi: #{greetingBean.name}” />
  • 20. Defining Ids • Server id update=”text” • Client id update=”form:text” • Comma separated update=”text,panel” • White space separated update=”text panel” • Mix update=”form:text grid” • Keywords update=”@form”
  • 21. Keywords • @this update=”@parent” • @parent • @form • @all • @none
  • 22. Partial Processing • Decide what to process • process attribute • Ajax requests • Non-ajax requests process=”@this”
  • 23. Partial Processing - Case 1 <h:form> <h:inputText id=”iamrequired” required=”true” /> <h:selectOneMenu id=”cities”> <p:ajax update=”cities” process=”@this” /> </h:selectOneMenu> <h:selectOneMenu id=”suburbs” /> </h:form>
  • 24. Partial Processing - Case 2 <h:form> <h:inputText id=”iamrequired” required=”true” /> <h:outputText id=”selected” /> <p:dataTable id=”table”> <p:column> <p:commandLink update=”selected” process=”table” /> </p:column> </p:dataTable> </h:form>
  • 25. Partial Processing - Case 3 <h:form> <h:inputText id=”iamrequired” required=”true” /> <h:commandButton action=”navigate” immediate=”true” /> </h:form> • Making immediate obsolete <h:form> <h:inputText id=”iamrequired” required=”true” /> <p:commandButton action=”navigate” process=”@this” /> </h:form>
  • 26. Process vs Update Restore View Apply Request Process Validations Update Model Invoke App Update Render
  • 27. Notifying Users • Declarative <p:ajaxStatus> ! ! <f:facet name="start"> ! ! ! <p:graphicImage value="fancyanimation.gif" /> ! ! </f:facet>! ! ! ! <f:facet name="complete"> ! ! ! <h:outputText value="Request Completed" /> ! ! </f:facet> </p:ajaxStatus> • Programmatic <p:ajaxStatus onstart=”alert(‘Started’)” oncomplete=”alert(‘done’)” />
  • 28. Global vs Non-Global • To trigger p:ajaxStatus or not <p:ajaxStatus> ! ! <f:facet name="start"> ! ! ! <p:graphicImage value="fancyanimation.gif" /> ! ! </f:facet>! ! ! ! <f:facet name="complete"> ! ! ! <h:outputText value="Request Completed" /> ! ! </f:facet> </p:ajaxStatus> • Global (Default) <p:commandButton value=”Submit” / • Silent <p:commandButton value=”Submit” global=”false” /
  • 29. Component specific callbacks • onstart • onsuccess • oncomplete • onerror <p:commandButton onstart=”return confirm(‘Sure’)” oncomplete=”alert(‘Done’);” />
  • 30. Callback Arguments <p:commandButton value=”Submit” action=”#{bean.save}” oncomplete=”handleComplete(xhr, status, args)” /> public void save() { RequestContext context = RequestContext.getCurrentInstance(); context.addCallbackParam(“item”, item); } • From backing bean to ajax callbacks with JSON <script type=”text/javascript”> function handleComplete(xhr, status, args) { alert(args.item.name); } </script>
  • 31. Ajax Remoting public class GreetingBean { private String name; //... public void toUpperCase() { name = name.toUpperCase(); } } • p:remoteCommand <p:remoteCommand name=”upperCase” actionListener=#{greetingBean.toUppterCase} /> <script type=”text/javascript”> upperCase(); </script>
  • 32. PPR Summary No Need For • Simple Ajax Servlet Filter • Easy to Use Html Parser • Flexible • Responsive Ajax ViewHandler • Lightweight Ajax StateManager • Keep it clean Ajax Regions Ajax*
  • 34. TouchFaces • Mobile UI Kit • WebKit Browsers • IPhone, Android, Palm • Native IPhone UI • Integrated Ajax • Regular JSF • Powered by jqTouch
  • 35. TouchFaces UI • <i:application /> • <i:view /> • <i:tableView /> • <i:rowGroup /> • <i:rowItem /> • <i:switch />
  • 36. TouchFaces in Action Translate Chat - Ajax Push PathFinder - GPS TwitFaces Weather Notes News
  • 38. Ajax Push/Comet • Built on top of Atmosphere • <p:push /> • CometContext.publish(...)
  • 39. Atmosphere Framework • Portable Comet Framework • Write Once, Deploy Anywhere • Rest support • Servlet 3.0 support • JSF Integration: PrimeFaces
  • 41. Chat App in a Minute public class ChatController { private String message; public void send(ActionEvent event) { CometContext.publish(“chat”, message); } //getters setters } <h:form> <h:inputText value=”#{chatController.message}” /> <p:commandButton value=”Send” actionListener=”#{chatController.send}” /> </h:form> <p:outputPanel id=”display” /> <p:push channel=”chat” onpublish=”handlePublish” /> <script type=”text/javascript”> function handlePublish(pushed) { ! $('#display').append(pushed.data); } </script>
  • 42. Pushing as JSON Player player = new Player(); player.setName(“Messi”); player.setAge(22); CometContext.publish(player); function handlePublish(pushed) { //pushed.data.name; //pushed.data.age; }
  • 43. Extensions: FacesTrace • Trace/Debug tool • Lifecycle visualizer • Performance Tracker • Visual component tree
  • 45. Integrate With • Spring • Spring Webflow • Seam • CDI • Portlets • See svn/examples
  • 46. Documentation • User’s Guide - 350 pages • Wiki • Screencasts • API & TLD Docs • Third party articles/blogs
  • 48. Enterprise Support • 2/4 hour average response time • Priority forum access • Ticket based portal • IM support over skype • JSF specific help • Special Case Support
  • 49. Community • Strong community feedback • 500 posts per week in forum • Join us!
  • 50. Coming Soon TreeTable ContextMenu ProgressBar and more.......
  • 51. Finale • [email protected] • Twitter: @cagataycivici, @primefaces • Facebook Group: 206606616332 • Blog: http://cagataycivici.wordpress.com • HomePage: http://www.primefaces.org • Atmosphere: http://atmosphere.dev.java.net