jsf2 complete tour

50
JavaServer Faces 2.0 The Complete Tour Ed Burns Sun Microsystems, Inc. Ed Burns Oracle America, Inc. JavaServer Faces 2.0 The Complete Tour

Upload: aloove66

Post on 24-Nov-2015

17 views

Category:

Documents


0 download

DESCRIPTION

java server faces

TRANSCRIPT

  • JavaServer Faces 2.0The Complete Tour

    Ed BurnsSun Microsystems, Inc.

    Ed BurnsOracle America, Inc.

    JavaServer Faces 2.0The Complete Tour

  • Java Developer Conference

    Agenda Introduction: set the context

    Basic Operation of JSF Request Processing Lifecycle

    What is it? Why do I have to understand it?

    JSF 2.0, from two viewpoints

    The Four Pillars of JSF New Feature Traversal

  • Java Developer Conference

    Speaker Qualifications: Ed Burns Principal Staff Member, Oracle America, Inc. Since inception, co-leader of the team that

    develops the JavaServer Faces (JSF) Specification Co-author of the McGraw-Hill book, JavaServer

    Faces, The Complete Reference and upcoming JSF2: The Complete Reference

    Author of the McGraw-Hill book: Secrets of Rock Star Programmers: Riding the IT Crest

    Prior to JSF Ed worked on the Sun Java Plug-in, Mozilla Open JavaVM Interface, NCSA Mosaic

  • Java Developer Conference

    All of the Faces Spec and Runtime Team at Oracle

    Ed Burns Roger Kitain

    Ryan Lubke

  • Java Developer Conference

    Most of the Faces of the JSR-314 EG

    Andy Schwartz

    Dan Allen

    Alexandr Smirnov

    Ken Paulsen

    Martin Marinschek

    Pete Muir

    Kito Mann

    Joe Ottinger

    Ted Goddard Neil GriffinJason Lee

    David Geary Mike Freedman

    Gavin King

    Jeremy Grelle

    Keith Donald

    Ed Burns

    Jim Driscoll

    Roger Kitain

    Ryan Lubke

  • Java Developer Conference

    Some of the Faces of the Faces Community

    Andy Schwartz

    Dan Allen

    Jacob HookomAlexandr Smirnov

    Ken Paulsen

    Martin Marinschek

    Matthias Weendorf

    Pete Muir

    Alexander Jesse

    Imre Owald

    Yara Senger

    Lincoln Baxter III

    Adam Winer

    Craig McClanahan

    Kito Mann

    Rick Hightower

    Joe Ottinger

    Ted Goddard Neil GriffinJason Lee

    Stan SilvertDavid Geary Mike Freedman

    Gavin King

    Hazem Saleh

    aatay ivici

    Dennis ByrneRoger Keays

    Amy Fowler

    Max Katz

    Jeremy Grelle

    Keith Donald

    Ed Burns

    Jim Driscoll

    Roger Kitain

    Ryan Lubke

    SpockRafael NunesVinny Nunes

  • Java Developer Conference

  • Java Developer Conference

    Basic Operation of JSF

  • Java Developer Conference

    JSF Request Processing Lifecycle

  • Java Developer Conference

    Wait a minute... Lots of complexity for just a simple

    thing: HTTP?

    Isn't it easier just to do REST?

    Real Web Frameworks don't try to hide the elegance of the web

  • Java Developer Conference

    Data Conversion and Validation

    Page Flow

    Database integration (Persistence Layer)

    All Web Applications Must Have...

    Performance

    Security

    I18N, L10N, A11Y

    Support CSS, Markup based layout

    User Friendliness!

    Developer End User

  • Java Developer Conference

    Complexity Must Live Somewhere

    Choosing JSF ==

    Choosing an Architecture

    Designed by industry experts

    Refined Over Five Years Time

    Widely Deployed in Production

  • Java Developer Conference

    JSF 2.0 From Two Viewpoints Four Pillars of JSF

    View Model Integration Navigation Lifecycle

    New Feature Traversal

  • Java Developer Conference

    Four Pillars of JSF

    Inversion of ControlInversion of Control

  • Java Developer Conference

    View JSF 2.0 Views are Facelets Pages

    JSP is deprecated

    Still works Most new features are not available to JSP

    users Facelets == XHTML + Industry Proven Templating

    Taglibs are XML namespaces

  • Java Developer Conference

    Demo: Facelets in NetBeans 6.8

  • Java Developer Conference

    Inversion of ControlInversion of Control

  • Java Developer Conference

    Model Interaction Powerful EL Expressions

    link components in View to Properties in Model

    Java EE 6 EL: Supports Arbitrary Method Invocation

    Two styles

    backing bean + POJO

    POJO

  • Java Developer Conference

    Inversion of ControlInversion of Control

  • Java Developer Conference

    Navigation JSF2.0 Implicit

    Navigation

    No XML Highly Dynamic Useful with flash

    object JSF 1.X Explicit

    Navigation

    Lots of XML Redeploy Required

  • Java Developer Conference

    Demo: Implicit Navigation

  • Java Developer Conference

    Inversion of ControlInversion of Control

  • Java Developer Conference

    LifecycleJSF 1.0

    Handles only View Declaration Request

    No Support for Ajax

    PhaseListeners: the only way to observe into the Lifecycle

    JSF 2.0

    Handles View Declaration Request + Resource Requests

    Excellent, well integrated support for Ajax

    System Events: fine grained lifecycle listening

  • Java Developer Conference

    Demo: Ajax

  • 25

    Ajax> Inspiration: RichFaces, IceFaces, DynamicFaces, ADF Faces

    >Two entry points: Declarative: tag, uses AjaxBehavior Programmatic ajax: resource library

    javax.faces, resource name jsf.js, JavaScript namespace jsf.ajax

    >Declarative ajax: useful to ajaxify non ajax pages

    >AjaxBehavior : great flexibility for most needs

    >Programmatic ajax API usage pattern

    jsf.ajax.request() JavaScript methodR

  • 26

    Ajax>PartialViewContext

    Used to process AjaxRequests on server Contains useful discovery methods

    >PartialResponseWriter

    Write standard Ajax response format

    >PartialViewContext and PartialResponseWriter are extensible

    R

  • Java Developer Conference

    JSF 2.0 New Feature Traversal

  • Java Developer Conference

  • Java Developer Conference

    Categories of New Features`

    Foundational

    Purpose built to support Large features

    Large

    Big Ticket Stuff Medium

    Very useful for advanced users

    Small

    Bug fixes and enhancements

    E

  • Java Developer Conference

    Fou nd at io nal N

    e w F ea tu re s

    Lar ge N

    e w

    Fea tu re s

    High Level Categories of Features

  • JSF 2.0 Vision for Compnents This...

  • Make components easy to develop Becomes this...

  • Or maybe this...

    if you want to get fancy

    Pay as you go complexity

    Make components easy to develop

  • JSF 2.0 Component Vision multi-select components on a

    JSF page

    press a componentize button

    you get a wizard that lets you choose how to expose the content of this component to the page author

    the component appears in a palette.

  • Demo: Simple Login Panel

  • Java Developer Conference

    Fou nd at io nal N

    e w F ea tu re s

    Lar ge N

    e w

    Fea tu re s

    High Level Categories of Features

  • 37

    Resources> Avoid need for separate Filter or Servlet.> Resources are logically related to components, treat

    them that way.> Load from Classpath, or filesystem> Full support for Library concept, I18N, Versioning

    R

  • 38

    ResourceRenderer outputsURL to resource

    R

  • 39

    Resources: Java API>@ResourceDependency or @ResourceDependencies

    annotation on UIComponent, Renderer, Validator, Converter, ClientBehavior

    >attributes for resource name, library name>attribute for target: head, body, form>Built in support for CSS, Image, JavaScript resources

    R

  • 40

    Resources: Markup API

    >, >, >Similar attributes for resource name, library name>Similar attribute for target: head, body, form

    R

  • Java Developer Conference

    Fou nd at io nal N

    e w F ea tu re s

    Lar ge N

    e w

    Fea tu re s

    High Level Categories of Features

  • 42

    View Parameters>Inspired by Page Parameters from JBoss Seam>Provides a way to map request parameters to special components within the view>>UIViewParameter extends UIInput>All attached objects valid for UIInput are valid>Breaks the tyranny of POST>Enables Bookmarkable pages

    R

  • Java Developer Conference

    Fou nd at io nal N

    e w F ea tu re s

    Lar ge N

    e w

    Fea tu re s

    High Level Categories of Features

  • 44

    System Events

    E

    >Influenced by JSFTemplating>Publish/Subscribe event bus for things that happen during the JSF Lifecycle, not application specific>Inspired by Solaris Dtrace, Linux strace, truss, etc.>Listeners can be registered at three scopes

    component UIComponent.subscribeToEvent() view UIViewRoot.subscribeToEvent() application Application.subscribeToEvent()

    >Publish is always with Application.publishEvent()

  • 45

    System Events: Standard Event Types

    E

  • Java Developer Conference

    Fou nd at io nal N

    e w F ea tu re s

    Lar ge N

    e w

    Fea tu re s

    High Level Categories of Features

  • Java Developer Conference

    Fou nd at io nal N

    e w F ea tu re s

    Lar ge N

    e w

    Fea tu re s

    High Level Categories of Features

  • Java Developer Conference

    Fou nd at io nal N

    e w F ea tu re s

    Lar ge N

    e w

    Fea tu re s

    High Level Categories of Features

  • Java Developer Conference

    Fou nd at io nal N

    e w F ea tu re s

    Lar ge N

    e w

    Fea tu re s

    High Level Categories of Features

  • Java Developer Conference

    JavaServer Faces 2.0The Complete Tour

    Ed BurnsOracle America, Inc.

    Java FX Adobe AIRAgendaSlide 3Slide 4Slide 5Slide 6Slide 7Slide 8Slide 9Slide 10Slide 11Slide 12Slide 13Slide 14Slide 15Slide 16Slide 17Slide 18Slide 19Slide 20Slide 21Slide 22Slide 23Slide 24Slide 25Slide 26Slide 27Slide 28Slide 29Slide 30Slide 31Slide 32Slide 33Slide 34Slide 35Slide 36Slide 37Slide 38Slide 39Slide 40Slide 41Slide 42Slide 43Slide 44Slide 45Slide 46Slide 47Slide 48Slide 49Slide 50