SlideShare a Scribd company logo
What’s new in
                                                          JSF 2.0 ?

                                                          Roi Aldaag
                                                          Consultant, AlphaCSP
                                                          roia@alphacsp.com

Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                            2
Objective



                       Overview of the new requested
                                     features of the upcoming
                                                        JSF 2.0




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar             3
Agenda

          Introduction
          JSF Evolution
                   JSF 1.0 / 1.1
                   JSF 1.2
          JSF 2.0
                   JSR 314
                   Community wish list
                   Technology Adoption
                   Ease of development
                   Features
                   Performance


Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   4
Introduction

          Something about acronyms
          Definition
          Motivation
          JSF Ecosystem
          Architecture




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   5
Something about acronyms…




                              Not so long ago, if you “Googled“
                             the word JSF, you probably would
                                    have come across …




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar             6
Something about acronyms…



                                    The F-35 Joint Strike Fighter (JSF) …
                                                        (AKA Lightning II)




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                        7
Something about acronyms…


          Today you’d find…



                           JavaServer Faces Technology



          And probably also …                                            Sponsored Links
                                                        AlphaCSP
                                                        Specializes in high availability e-business
                                                        application design and ASP hosting
                                                        services on the UML, EJB, JAVA, J2EE,
                                                        CORBA, XML and WML platforms.
                                                        www.alphacsp.com

Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                                                 8
Definition


          What is JSF?
                   Specification
                   UI framework
                   Component based
                   Server side
                   Java web applications




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   9
Motivation


          Servlet/JSP API
                   No          GUI structure
                   No          model
                   No          event handling mech.
                   No          I18N support
          AWT / Swing
                   Not web oriented
          Many web frameworks



Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   10
“Welcome to the jungle”

                                     Java Web Frameworks (partial list)
                Echo                                    Bishop             Macaw
                Cocoon                                  Barracuda          Smile
                Millstone                               Action Framework   MyFaces
                OXF                                     Shocks             Chiba
                                                                           JBanana
                Struts
                SOFIA
                                                        JSF                Jeenius
                                                        TeaServlet         JWarp …
                Tapestry
                                                        wingS
                WebWork
                                                        Expresso
                RIFE
                                                        Bento
                Spring MVC
                                                        jStatemachine
                Canyamo
                                                        jZonic
                Maverick
                                                        OpenEmcee
                JPublish
                                                        Turbine
                JATO
                                                        Scope
                Folium
                                                        Warfare
                Jucas
                                                        JWAA
                Verge
                                                        Jaffa
                Niggle
                                                        Jacquard

Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                                11
Motivation


          How do we choose?
          We need a standard !
                   Vendor adoption
                   IDE integration
                   Support
          JSF is a standard




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   12
JSF Ecosystem

                     • Open Source Projects:
                       SourceForge.net: over 100 projects
                     • Implementations
                       Open Source: Sun JSF RI, Apache MyFaces
                       Commercial: IBM, Oracle
                     • Third Party Components
                       IceSoft IceFaces, JBoss RichFaces, Oracle ADF,
                       Apache Tomahawk, Galileo Faces
                     • Extensions
                       Ajax4JSF, Dyno Faces, JSF Extensions
                     • IDE Support
                       IntelliJ, Eclipse, JDeveloper, Excadel Studio


Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                   13
Architecture

                                                                            Controller                                    • Model
                                                                                                         Config
                                                                                                    (faces-config.xml)



                                                                                                                          • View
                                                                                                                          • Controller
                                                                                   Events
           Request                                                           (ValueChangeEvent,
                                                                                 ActionEvent)
                                                                                                  Event Listeners &
                                       Front Servlet                                               Action Handlers
                                        (FacesServlet)                                            (ValueChangeListener,
                                                                                                      ActionListener)




                                        Component
                                          Tree                              Component                  Business
                                       (UIComponent)                          Model                     Objects
                                                                            (Java Beans)            (Managed Beans)



                                            UIViewRoot
                                                                            Delegates
                                                 UIForm                     (Convertors,
                                                                             Validators,
                                                                             Renderers)
           Response                              UIPanel


                                       UIInput             UIInput


                                                                            Resources
                                                                               (JSP,
                                                                               XML,
                                                                            Properties)


                                                                     View                              Model



Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                                                                                    14
Architecture

                                                                            Controller                                    • Controller
                                                                                                         Config
                                                                                                    (faces-config.xml)


                                                                                                                          • Front Servlet
           Request                                                                 Events
                                                                             (ValueChangeEvent,
                                                                                 ActionEvent)
                                                                                                  Event Listeners &
                                                                                                                          • Configuration
                                       Front Servlet                                               Action Handlers


                                                                                                                          • Event Listeners
                                        (FacesServlet)                                            (ValueChangeListener,
                                                                                                      ActionListener)




                                        Component
                                          Tree                              Component                  Business
                                       (UIComponent)                          Model                     Objects
                                                                            (Java Beans)            (Managed Beans)



                                            UIViewRoot
                                                                            Delegates
                                                 UIForm                     (Convertors,
                                                                             Validators,
                                                                             Renderers)
           Response                              UIPanel


                                       UIInput             UIInput


                                                                            Resources
                                                                               (JSP,
                                                                               XML,
                                                                            Properties)


                                                                     View                              Model



Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                                                                                         15
Architecture

                                                                            Controller                                    • Model
                                                                                                         Config
                                                                                                    (faces-config.xml)


                                                                                                                          • Business Objects
           Request                                                                 Events
                                                                             (ValueChangeEvent,
                                                                                 ActionEvent)
                                                                                                  Event Listeners &
                                                                                                                          • POJO’s
                                       Front Servlet                                               Action Handlers
                                        (FacesServlet)                                            (ValueChangeListener,
                                                                                                      ActionListener)




                                        Component
                                          Tree                              Component                  Business
                                       (UIComponent)                          Model                     Objects
                                                                            (Java Beans)            (Managed Beans)



                                            UIViewRoot
                                                                            Delegates
                                                 UIForm                     (Convertors,
                                                                             Validators,
                                                                             Renderers)
           Response                              UIPanel


                                       UIInput             UIInput


                                                                            Resources
                                                                               (JSP,
                                                                               XML,
                                                                            Properties)


                                                                     View                              Model



Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                                                                                          16
Architecture

                                                                            Controller                                    • View
                                                                                                         Config
                                                                                                    (faces-config.xml)


                                                                                                                          • Component Tree
           Request                                                                 Events
                                                                             (ValueChangeEvent,
                                                                                 ActionEvent)
                                                                                                  Event Listeners &
                                                                                                                          • Component Model
                                       Front Servlet                                               Action Handlers


                                                                                                                          • Delegates
                                        (FacesServlet)                                            (ValueChangeListener,
                                                                                                      ActionListener)




                                                                                                                          • Resources
                                        Component
                                          Tree                              Component                  Business
                                       (UIComponent)                          Model                     Objects
                                                                            (Java Beans)            (Managed Beans)



                                            UIViewRoot
                                                                            Delegates
                                                 UIForm                     (Convertors,
                                                                             Validators,
                                                                             Renderers)
           Response                              UIPanel


                                       UIInput             UIInput


                                                                            Resources
                                                                               (JSP,
                                                                               XML,
                                                                            Properties)


                                                                     View                              Model



Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                                                                                         17
Architecture


          Lifecycle
                   Restore view
                   Apply request values
                   Process validations
                   Update model values
                   Invoke application
                   Render response




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   18
Architecture


          Example
                   JSP with JSF tags
                   Component Tree
                   Markup
          ...
                                                             UIViewRoot
          <f:fiew>
                                                                                      HTML
            <h:form>
             <h:panelGrid columns = "2">                          UIForm
                <h:inputText/>
                <h:inputSecret/>                                                      WML
              </panelGrid>
                                                                  UIPanel
            </h:form>
          </f:view>
          ..
                                    JSP                                               XML
                                                        UIInput             UIInput




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                                        19
JSF Evolution




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   20
JSF Evolution

          History
          JSF 1.0 / 1.1
          JSF 2




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   21
History

      JSF 1.0, 1.1                                      JSF 1.2                JSF 2.0
      JSR 127                                           JSR 252                JSR 314
      Servlet 2.3, JSP 1.2                              Servlet 2.5, JSP 2.1
      JSR Review Ballot:                                JSR Review Ballot:     JSR Review Ballot:
      May 2001                                          August 2004            May 2007
      Final Release 2:                                  Final Release 2:       Final Release 2:
      May 2004                                          May 2006               JEE6 – 4Q 2008




              2004                                        2006                  2008 ??




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                                               22
JSF 1.1 (JSR 127)‫‏‬

          Shortcomings
                   JSF – JSP Mismatch

      <h:commandLink action="foo">
                                                        Read between the lines
        Read between the lines
                                                        <a href=“#” onClick=“…”></a>
      </h:commandLink>




     <h:commandLink action="foo">                       <a href=“#” onClick=“…”>
       <h:outputText                                       Read between the lines
        value="Read between the lines”/>                </a>
     </h:commandLink>



Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                                  23
JSF 1.1 (JSR 127)‫‏‬

          Shortcomings
                   JSF – JSP Mismatch
                             Different Lifecycle
                             Writing to the same stream
                   Limited EL
                             Not compatible with JSP EL
                             Forbidden nesting components (<c:forEach>)‫‏‬




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                      24
JSF 1.2 (JSR 252)‫‏‬

                                                                       JSP EL    JSF EL

          Improvements
                   New Content Interweaving Model
                             JSP ViewHandler, JSP Base Tag class           Unified EL

                   Unified EL in JSTL (javax.el)
                             Deferred evaluation
                             Support get / set value
                             Support method invocation
                             Pluggable API for resolving expressions
                   JSTL integration (<c:forEach>)‫‏‬
                   Back Button / Multi Frame Apps
                   Message association

Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                                     25
JSF 1.2 (JSR 252)‫‏‬

          Shortcomings
                   Development
                             Customizing components is complicated
                             Exceptions are not descriptive
                             No support for annotations
                   Deployment
                             Unnecessary deployment step
                             Not JEE compliant (packaging, DI)‫‏‬
                   Components
                             Missing / Limited components
                   Security
                             No security model (managed beans, resources)‫‏‬
                   Ajax

Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                        26
Custom Components

                                                        Let’s say we
                                                        want a
                                                        collapsible
                                                        panel …




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                  27
Custom Components: JSF 1.2


         UIComponentBase.java                           UIComponentTag.java   extend




                  UICollapse.java                         CollapseTag.java
                                                                              write


                      collapse.tld




                 faces-config.xml                                             modify


Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                                  28
Custom Components: JSF 1.2


                  UICollapse.java




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   29
Custom Components: JSF 1.2


                CollapseTag.java




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   30
Custom Components: JSF 1.2


                      collapse.tld




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   31
Custom Components: JSF 1.2


                 faces-config.xml




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   32
Custom Components: JSF 1.2


                                                  Too much wiring !!!




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                   33
Custom Components: Facelets


                   collapse.xhtml




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   34
Exceptions: JSF 1.2

          No centralized exception handling
                   Servlet filter
          Poor documentation
          “Silent error”
                   Validation error
                   No Exception
                   No log output
                   Need to use <h:messages/>
          Unified EL wraps exception

Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   35
Exceptions: JSF 1.2
      exception.jsf
             <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
             <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
             <f:view>
             <h:form>
                    <h:inputText value="#{myBean.name}"/>
             </h:form>
             </f:view>

       MyBean.class
             public class MyBean {
                public String getName() {
                   if(true) throw new RuntimeException("my exception");
                   return "line not reached";
                }
                . . .
             }

Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                     36
Exceptions: JSF 1.2

          Instead of
          A stack trace dump


                  javax.servlet.ServletException:
                  javax/servlet/jsp/tagext/JspIdConsumer




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar      37
Exceptions: Facelets

          We should be getting
          Verbose description (location, tree, phase, variables)‫‏‬


                  javax.el.ELException: /exception.xhtml @7,40
                  value="#{myBean.name}": java.lang.RuntimeException




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                  38
Ajax: JSF 1.2

          • Good:
                   –         Ajax “ready”
                   –         JSF component maintain state
                   –         Well defined req processing
                   –         Hides JS from page author
          • Bad:
                   –         No built-in support
                   –         No standard
                   –         Full view rendering
                   –         Incompatible comp. libraries

Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar       39
Templating: JSF 1.2

          • No standard support
                   – <f:subview../>
                   – <c:import…/>
                   – <jsp:include …/>
                                                              Header



                                                        Nav     Content



                                                              Footer



Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                     40
Community Reservations


                                                    “… It is OK to learn things,
                                                    but learning should be like
                                                   series of "AHA!" moments
                                                 and "WOW! they do that too!"
                                                           exclamations.

                                                         Learning JSF is series
                                                          of WTF moments -
                                                        and it should not be! …”


                                         “JSF Articles – Wish List for JSF 2.0 and more AJAX+JSF”,
                                                       The Server Side, April 05, 2007


Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                                                41
Community Reservations


                   “… I download 1 framework and it should be complete.
                   Don't tell me I need to download 5 other packages from
                         various websites to make it actually useful??? …”

           “… JSF should not be like a mine-field. It should be fun to use.
                 It should be impossible for a silent error to occur, and
                this is exactly what happens when you have a validation
                    error but no corresponding h:message(s) tag. …”


                                                News / Comments -“JSF sucks...and has no hope”
                                                           The Server Side, 2007




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                                            42
Community Wish List

          Facelets integration
          Client Side Validation
          Scoping
          Easier Development of components
          Simplify configuration
          Centralized Exception handling
          Navigation Rules API
          Hard failure
          …




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   43
The Irony

          JSF defined a standard
          UI development has advanced
          JSF got “old”
                   Many great ideas
                   Many JSF extensions (to fill void)‫‏‬
                   New technologies
          Irony: Back to starting point
          Need for a new standard

Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar    44
JSF 2.0

          JSR 314
          Ease of development
          Technology Adoption
          Features
          Performance




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   45
JSR 314

          Purpose
                   Max. development productivity (IDE)‫‏‬
                   Min. maintenance complexity
                   Integrate with other web tech.
                   More responsive UI (Ajax)‫‏‬
          Requirements
                   Ease of development
                   New Features & Fixes
                   Performance & Scalability
                   Technology Adoption
Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar     46
JSR 314




               Specification Lead
               Ed Burns Sun Microsystems, Inc.
               Roger Kitain Sun Microsystems, Inc.

Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   47
JSR 314

          Milestones (anticipated):
             Stage                                      Start       Finish
             Author 1st Draft                           7 Feb 07     9 Feb 07
             2nd Draft Reviewed                         15 Feb 07    9 Mar 07
             Author 1st EG Public Draft                 7 Mar 07     9 Mar 07
             1st EG Public Draft Review                 9 Mar 07     16 Mar 07
             File JSR with JCP                          Apr 07        Apr 07
             JSR Review Ballot                          Apr 07        May 07
             EG Formation                               May 07        Aug 07
             Early Draft Review                         Oct 07        Oct 07
             Public Review                              Feb 08        Mar 08
             Public Review Ballot                       Mar 08        Apr 08
             Proposed Final Draft                       JavaEE6

Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                            48
JSR 314

          Introducing the Experts




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   49
Let the experts play

          Expert Group Kick-off
              Meeting
          Buy a Feature
          Will the community
              needs be met?




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   50
Let the experts play (cont.)

          Feature List (partial):
                  Name                             Feature                                 Cost
                  Facelets                         Templating, Component Aggregation       165
                  Zero Dep                         Eliminate Deployment Step               100
                  EZComp                           Simplify creation of customize          100
                                                   components
                  Ajax                             Expand lifecycle to be aware of Ajax,    80
                                                   client lifecycle
                  Errors                           Better error reporting                   80
                  Listeners                        New listeners for lifecycle events       50



Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                                             51
Let the experts play (cont.)

          Feature List (cont.):
                  Name                              Feature                                   Cost
                  Config.                           No faces-confix.xml, no web.xml            50
                  Mostly Get                        Bookmarking, support got “GET”             80
                  Annotations Components, managed beans,                                       25
                              navigation rules
                  Rendering                         Declarative rendering (no out.println)‫‏‬    25

                  Fix State                         Default to stateless components            80
                  Skins                             Skinning / Themeing                        60



Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                                                52
Let the experts play (cont.)

          The Results:
                  Name                                  Number of units purchased   Cost
                  Ajax                                             5                80
                  Facelets                                         4                165
                  Annotations                                      4                25
                  State Saving                                     4                80
                  Validation++                                     4                15
                  EZComp                                           3                100
                  Errors                                           3                80



Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                                      53
JSF 2.0

          JSR 314
          Ease of development
          Technology Adoption
          Features
          Performance




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   54
Ease Of Development

          Annotations
          Templating
          Component Aggregation
          Verbose Exceptions
          JSF Artifacts in WAR




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   55
Ease Of Development

          Annotations




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   56
Ease Of Development

          Annotations: JSF 1.2
          • Tedious XML
                   – faces-config.xml
                   – Web.xml
          • JEE 5 Annotations
                   – @EJB
                   – @PersistenceContext
                   –…




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   57
Ease Of Development

          Annotations: JSF 2.0
          • Artifacts
                   – Managed beans      @Property(el=true, saveState=true)‫‏‬
                   – Scope
                   – Navigation Rules                 @Bean
                   – Dependency Injection        @PhaseListener
                   – Converters                    @Converter
                   – Validators
          • Zero Configuration
          • Skip deployment

Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                         58
Ease Of Development

          Templating
          • Faceletes                                         Header
                   – Develop UI live
          • JSF Templating                              Nav     Content
                   – Pages, components
          • Struts Tiles
                                                              Footer
                   – Layouts
                   – Screen definition
                   – Inheritance


Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                     59
JSF 2.0

          JSR 314
          Ease of development
          Technology Adoption
          Features
          Performance




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   60
Technology Adoption

          Ajax
          Passing values between pages
          Skinning / Themeing
          Web Beans JSR 299
          Client lifecycle / validation
          Server Side Scripting




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   61
Technology Adoption

          Ajax: Page wide
          •          Page wide support (region, zone)‫‏‬
          •          Add support to existing components
          •          Sub view processing
          •          Partial tree rendering
          •          Normal lifecycle
          •          Partial page refresh
          •          Example:
                     Ajax4Jsf, Dynamic Faces



Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar     62
Technology Adoption

          Ajax: Component wide
          •          Ajaxified components
                   –         Minimal Ajax awareness required
          •          Example:
                   – RichFaces, IceFaces, ADF (Trinidad)‫‏‬
                    RCFaces, Galileo Faces, Woodstock
          •          Client validations
          •          Client component interaction




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar          63
Technology Adoption

          Ajax example:




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   64
Technology Adoption
      <f:view>                                          Ajax4Jsf example:
         <h:outputText value="Ajax List Demo"/>
         <h:form>
            <h:panelGrid columns="2">
               <h:panelGrid>
           <a4j:region>
                  <h:outputText value="Country:"/>
              <h:selectOneListbox id="countryId">
                  <a4j:region>
                  <f:selectItems value="#{myBean.countries}" />
                     <h:selectOneListbox id="countryId">
                        <f:selectItems value="#{myBean.countries}" />
                      <a4j:support event="onchange" reRender="cityId"
                        <a4j:support event="onchange" reRender="cityId"
                        action="#{myBean.changeCountry}" ajaxSingle="true"/>
                           action="#{myBean.changeCountry}" ajaxSingle="true"/>
              </h:selectOneListbox>
                     </h:selectOneListbox>
           </a4j:region>
                  </a4j:region>
               </h:panelGrid>
               <h:panelGrid>
                 <h:outputText value="City:"/>
                 <h:selectOneListbox id="cityId">
                    <f:selectItems value="#{myBean.cities}" />
                 </h:selectOneListbox>
               </h:panelGrid>
            </h:panelGrid>
            <h:commandButton value="Submit" action="none" />
         </h:form>
      </f:view>
Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                             65
Technology Adoption

       Partial Page Submit                              Partial Tree Decode


                                                                             AjaxViewRoot


                                                                       UIOutput             UIForm


                                                                                  UIPanel            UICommand


                                                                   UIPanel                        UIPanel


                                                        UIOutput      UISelectOne           UIOutput        UISelectOne




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                                                                     66
Technology Adoption

       Partial Page Refresh                             Partial Tree Render


                                                                             AjaxViewRoot


                                                                       UIOutput             UIForm


                                                                                  UIPanel            UICommand


                                                                   UIPanel                        UIPanel


                                                        UIOutput      UISelectOne           UIOutput        UISelectOne




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                                                                     67
Technology Adoption

          Passing values between pages: JSF 1.2
          Supported scopes
                      Page, Session, Application
             State
                   Client: Cookie, URL encoding, hidden field
                   Server: HttpSession, ServletContext




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar           68
Technology Adoption

          Passing values between pages
          Dialog / Conversation / Process scope
          Example:
                   JBoss Seam
                   Apache Shale
                   Spring WebFlow
                   Oracle ADF




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   69
Technology Adoption




                                                        Skinning /
                                                        Themeing




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                70
Technology Adoption

          Skinning / Themeing
          • Changing component style
                    – Dynamically
                    – Instantly
          • Technologies
                    – Oracle ADF Faces
                    – Apache Trinidad
                    – JBoss Rich Faces
                    – Icesoft IceFaces


Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   71
Technology Adoption

          Skinning / Themeing
          • Example:




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   72
JSF 2.0

          JSR 314
          Ease of development
          Technology Adoption
          New Features
          Performance




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   73
New Features

          Separate build / render tree
          Bookmarking
          Additional standard components
          AJAX aware lifecycle
          Partial tree traversal
          Page actions
          Access to persistence store


Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   74
New Features

          Separate build / render tree
                   Initial Request
                             Render Response Phase
                                      Create Component Tree
                                      Render Tree
                   Postback Request
                             Restore View Phase
                                      Create Component Tree
                             Render Response Phase
                                      Render Tree



Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar         75
New Features

          Bookmarking
                   JSF 1.2
                             No support in <h:form/>
                             Command component don’t generate GET
                             Use implicit “param”
                   Enhanced Support for Http GET
                             New lifecycle for non-faces request (init req)‫‏‬
                             Submitted values come from HTTP params
                              not (input components)‫‏‬




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                          76
New Features

          Additional standard components
                   Current set is to weak
                   Components from different vendors cannot coexist

            Date Picker                                 File Upload    Tree




                                                        Tabbed Panel




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                         77
JSF 2.0

          JSR 314
          Ease of development
          Technology Adoption
          Features
          Performance




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   78
Performance

          Save / restore page deltas
                   ADF
          Client side component validations
          Inter client component interaction
                   Example: Dual combo box
          Caching for rendering
          Improve PhaseListener Interceptor
                   Filter requests

Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   79
Prolog

          The question should be:
                   Not - will the community needs be met ?
                   But, will the community needs be met -
                    on time … ?




Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar        80
Q&A
Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar   81
Definition

                          What is JSF ?
                          A server side user interface component framework for Java technology based
                          web applications.
                                                                                   Sun J2EE 1.4 Tutorial

                          A component-based, Web-tier UI framework
                                                                  Mastering JavaServer Faces, Wiley 2004

                          A component architecture
                          A standard set of UI widgets
                          An application infrastructure
                                                                JavaServer Faces in Action, Manning 2005

                          A specification with implementations offered by multiple vendors
                          A set of user interface (UI) components
                          API for extending the standard components or developing new
                                                                         JavaServer‫‏‬Faces,‫‏‬O’Reilly‫4002‏‬

                          A set of prefabricated UI (user interface) components
                          An event-driven programming model
                          A component model that enables third-party developers to supply additional
                          components
                                                                        Core JavaServer Faces, Sun 2007



Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                                                      82
Resources

          JSR Draft
                   https://javaserverfaces-spec-public.dev.java.net/
                      proposals/JSF-2_0-draft.html

          JCP – JSR 314
                   http://jcp.org/en/jsr/detail?id=314


          Ed Burns Blog
                   http://weblogs.java.net/blog/edburns


          “The Requirements Scratchpad”
                   http://wiki.java.net/bin/view/Projects/Jsf2RequirementsScratchpad


          Community Forums & Blogs



Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                                  83
Wish List

          Pre-JCP-filed draft for JavaServer Faces 2.0
            JSR / Ed Burns
                   http://weblogs.java.net/blog/edburns

            JSF 2.0 requirements scratchpad
                   http://wiki.java.net

          JSF 2.0 is Here!
                   http://www.oreillynet.com/onjava

          JSF 2.0 Wish List Part 1 /                    Kito Man
                   http://www.jsfcentral.com

          EE6 wishlist part II: JSF /                   Gavin King
                   http://in.relation.to

          JSF 2.0 Begins
          …
Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar                84

More Related Content

What's hot

[Challenge:Future] Chocoholic
[Challenge:Future] Chocoholic [Challenge:Future] Chocoholic
[Challenge:Future] Chocoholic
Challenge:Future
 
Florian adler minute project
Florian adler   minute projectFlorian adler   minute project
Florian adler minute project
Dmitry Buzdin
 

What's hot (20)

S109 cics-java
S109 cics-javaS109 cics-java
S109 cics-java
 
Running your Java EE 6 applications in the Cloud @ Silicon Valley Code Camp 2010
Running your Java EE 6 applications in the Cloud @ Silicon Valley Code Camp 2010Running your Java EE 6 applications in the Cloud @ Silicon Valley Code Camp 2010
Running your Java EE 6 applications in the Cloud @ Silicon Valley Code Camp 2010
 
OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010
OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010
OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010
 
[Challenge:Future] Chocoholic
[Challenge:Future] Chocoholic [Challenge:Future] Chocoholic
[Challenge:Future] Chocoholic
 
Making the Switch: One Team's Story of Adopting JIRA, FishEye, Eclipse & Myly...
Making the Switch: One Team's Story of Adopting JIRA, FishEye, Eclipse & Myly...Making the Switch: One Team's Story of Adopting JIRA, FishEye, Eclipse & Myly...
Making the Switch: One Team's Story of Adopting JIRA, FishEye, Eclipse & Myly...
 
GlassFish Community Update @ JavaOne 2011
GlassFish Community Update @ JavaOne 2011GlassFish Community Update @ JavaOne 2011
GlassFish Community Update @ JavaOne 2011
 
EclipseCON2012 - Enterprise OSGi for Earthlings: Meet Eclipse Libra
EclipseCON2012 - Enterprise OSGi for Earthlings: Meet Eclipse LibraEclipseCON2012 - Enterprise OSGi for Earthlings: Meet Eclipse Libra
EclipseCON2012 - Enterprise OSGi for Earthlings: Meet Eclipse Libra
 
Java EE Technical Keynote at JavaOne Latin America 2011
Java EE Technical Keynote at JavaOne Latin America 2011Java EE Technical Keynote at JavaOne Latin America 2011
Java EE Technical Keynote at JavaOne Latin America 2011
 
Java certifications
Java certificationsJava certifications
Java certifications
 
Pointwest. Agility Defined.
Pointwest. Agility Defined.Pointwest. Agility Defined.
Pointwest. Agility Defined.
 
TDC 2011: OSGi-enabled Java EE Application
TDC 2011: OSGi-enabled Java EE ApplicationTDC 2011: OSGi-enabled Java EE Application
TDC 2011: OSGi-enabled Java EE Application
 
Java EE 7: Developing for the Cloud at Java Day, Istanbul, May 2012
Java EE 7: Developing for the Cloud at Java Day, Istanbul, May 2012Java EE 7: Developing for the Cloud at Java Day, Istanbul, May 2012
Java EE 7: Developing for the Cloud at Java Day, Istanbul, May 2012
 
JavaOne2015報告会 in Okinawa
JavaOne2015報告会 in OkinawaJavaOne2015報告会 in Okinawa
JavaOne2015報告会 in Okinawa
 
The Java EE 7 Platform: Developing for the Cloud
The Java EE 7 Platform: Developing for the CloudThe Java EE 7 Platform: Developing for the Cloud
The Java EE 7 Platform: Developing for the Cloud
 
Java Summit Chennai: Java EE 7
Java Summit Chennai: Java EE 7Java Summit Chennai: Java EE 7
Java Summit Chennai: Java EE 7
 
Florian adler minute project
Florian adler   minute projectFlorian adler   minute project
Florian adler minute project
 
Java EE 7: Developing for the Cloud at Geecon, JEEConf, Johannesburg
Java EE 7: Developing for the Cloud at Geecon, JEEConf, JohannesburgJava EE 7: Developing for the Cloud at Geecon, JEEConf, Johannesburg
Java EE 7: Developing for the Cloud at Geecon, JEEConf, Johannesburg
 
Java EE 6 & GlassFish v3: Paving the path for the future - Spark IT 2010
Java EE 6 & GlassFish v3: Paving the path for the future - Spark IT 2010Java EE 6 & GlassFish v3: Paving the path for the future - Spark IT 2010
Java EE 6 & GlassFish v3: Paving the path for the future - Spark IT 2010
 
GlassFish REST Administration Backend
GlassFish REST Administration BackendGlassFish REST Administration Backend
GlassFish REST Administration Backend
 
Java EE7 in action
Java EE7 in actionJava EE7 in action
Java EE7 in action
 

Viewers also liked (6)

Seminar.2009.Performance.Intro
Seminar.2009.Performance.IntroSeminar.2009.Performance.Intro
Seminar.2009.Performance.Intro
 
Rich Ajax Platform - theEdge 2012 conference presentation
Rich Ajax Platform - theEdge 2012 conference presentationRich Ajax Platform - theEdge 2012 conference presentation
Rich Ajax Platform - theEdge 2012 conference presentation
 
Single Sourcing RAP and RCP - Desktop and web clients from a single code base
Single Sourcing RAP and RCP - Desktop and web clients from a single code baseSingle Sourcing RAP and RCP - Desktop and web clients from a single code base
Single Sourcing RAP and RCP - Desktop and web clients from a single code base
 
cloud computing ppt
cloud computing pptcloud computing ppt
cloud computing ppt
 
Introduction of Cloud computing
Introduction of Cloud computingIntroduction of Cloud computing
Introduction of Cloud computing
 
How to Build a Dynamic Social Media Plan
How to Build a Dynamic Social Media PlanHow to Build a Dynamic Social Media Plan
How to Build a Dynamic Social Media Plan
 

Similar to Java Edge.2007.What.Is.New.In.Jsf.2

Wp Glass Fish Overview
Wp Glass Fish OverviewWp Glass Fish Overview
Wp Glass Fish Overview
guest1c7a38
 
Glass Fish Slides Fy2009 2
Glass Fish Slides Fy2009 2Glass Fish Slides Fy2009 2
Glass Fish Slides Fy2009 2
Abhishek Gupta
 
Glass Fish Slides Fy2009 2
Glass Fish Slides Fy2009 2Glass Fish Slides Fy2009 2
Glass Fish Slides Fy2009 2
Abhishek Gupta
 

Similar to Java Edge.2007.What.Is.New.In.Jsf.2 (20)

JSF-Starter
JSF-StarterJSF-Starter
JSF-Starter
 
Sun Java EE 6 Overview
Sun Java EE 6 OverviewSun Java EE 6 Overview
Sun Java EE 6 Overview
 
Java EE 6 and GlassFish v3: Paving the path for future
Java EE 6 and GlassFish v3: Paving the path for futureJava EE 6 and GlassFish v3: Paving the path for future
Java EE 6 and GlassFish v3: Paving the path for future
 
Glass Fishv3 March2010
Glass Fishv3 March2010Glass Fishv3 March2010
Glass Fishv3 March2010
 
Java EE 6 and GlassFish portfolio
Java EE 6 and GlassFish portfolioJava EE 6 and GlassFish portfolio
Java EE 6 and GlassFish portfolio
 
Java EE / GlassFish Strategy & Roadmap @ JavaOne 2011
Java EE / GlassFish Strategy & Roadmap @ JavaOne 2011Java EE / GlassFish Strategy & Roadmap @ JavaOne 2011
Java EE / GlassFish Strategy & Roadmap @ JavaOne 2011
 
Wp Glass Fish Overview
Wp Glass Fish OverviewWp Glass Fish Overview
Wp Glass Fish Overview
 
Glass Fish Slides Fy2009 2
Glass Fish Slides Fy2009 2Glass Fish Slides Fy2009 2
Glass Fish Slides Fy2009 2
 
JBoss AS 7 from a user perspective
JBoss AS 7 from a user perspectiveJBoss AS 7 from a user perspective
JBoss AS 7 from a user perspective
 
JBoss AS / EAP and Java EE6
JBoss AS / EAP and Java EE6JBoss AS / EAP and Java EE6
JBoss AS / EAP and Java EE6
 
JBoss AS7 Reloaded
JBoss AS7 ReloadedJBoss AS7 Reloaded
JBoss AS7 Reloaded
 
Glass Fish Slides Fy2009 2
Glass Fish Slides Fy2009 2Glass Fish Slides Fy2009 2
Glass Fish Slides Fy2009 2
 
Java EE Technical Keynote - JavaOne India 2011
Java EE Technical Keynote - JavaOne India 2011Java EE Technical Keynote - JavaOne India 2011
Java EE Technical Keynote - JavaOne India 2011
 
Java EE 6 and GlassFish v3: Paving the path for future
Java EE 6 and GlassFish v3: Paving the path for futureJava EE 6 and GlassFish v3: Paving the path for future
Java EE 6 and GlassFish v3: Paving the path for future
 
Java EE 6 and GlassFish v3: Paving the path for future
Java EE 6 and GlassFish v3: Paving the path for futureJava EE 6 and GlassFish v3: Paving the path for future
Java EE 6 and GlassFish v3: Paving the path for future
 
JavaEE6
JavaEE6JavaEE6
JavaEE6
 
Jsf 2.0 Overview
Jsf 2.0 OverviewJsf 2.0 Overview
Jsf 2.0 Overview
 
Java EE 6 : Paving The Path For The Future
Java EE 6 : Paving The Path For The FutureJava EE 6 : Paving The Path For The Future
Java EE 6 : Paving The Path For The Future
 
Overview of JPA (Java Persistence API) v2.0
Overview of JPA (Java Persistence API) v2.0Overview of JPA (Java Persistence API) v2.0
Overview of JPA (Java Persistence API) v2.0
 
20070329 Tech Study
20070329 Tech Study 20070329 Tech Study
20070329 Tech Study
 

Java Edge.2007.What.Is.New.In.Jsf.2

  • 1.
  • 2. What’s new in JSF 2.0 ? Roi Aldaag Consultant, AlphaCSP roia@alphacsp.com Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 2
  • 3. Objective Overview of the new requested features of the upcoming JSF 2.0 Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 3
  • 4. Agenda Introduction JSF Evolution JSF 1.0 / 1.1 JSF 1.2 JSF 2.0 JSR 314 Community wish list Technology Adoption Ease of development Features Performance Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 4
  • 5. Introduction Something about acronyms Definition Motivation JSF Ecosystem Architecture Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 5
  • 6. Something about acronyms… Not so long ago, if you “Googled“ the word JSF, you probably would have come across … Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 6
  • 7. Something about acronyms… The F-35 Joint Strike Fighter (JSF) … (AKA Lightning II) Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 7
  • 8. Something about acronyms… Today you’d find… JavaServer Faces Technology And probably also … Sponsored Links AlphaCSP Specializes in high availability e-business application design and ASP hosting services on the UML, EJB, JAVA, J2EE, CORBA, XML and WML platforms. www.alphacsp.com Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 8
  • 9. Definition What is JSF? Specification UI framework Component based Server side Java web applications Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 9
  • 10. Motivation Servlet/JSP API No GUI structure No model No event handling mech. No I18N support AWT / Swing Not web oriented Many web frameworks Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 10
  • 11. “Welcome to the jungle” Java Web Frameworks (partial list) Echo Bishop Macaw Cocoon Barracuda Smile Millstone Action Framework MyFaces OXF Shocks Chiba JBanana Struts SOFIA JSF Jeenius TeaServlet JWarp … Tapestry wingS WebWork Expresso RIFE Bento Spring MVC jStatemachine Canyamo jZonic Maverick OpenEmcee JPublish Turbine JATO Scope Folium Warfare Jucas JWAA Verge Jaffa Niggle Jacquard Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 11
  • 12. Motivation How do we choose? We need a standard ! Vendor adoption IDE integration Support JSF is a standard Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 12
  • 13. JSF Ecosystem • Open Source Projects: SourceForge.net: over 100 projects • Implementations Open Source: Sun JSF RI, Apache MyFaces Commercial: IBM, Oracle • Third Party Components IceSoft IceFaces, JBoss RichFaces, Oracle ADF, Apache Tomahawk, Galileo Faces • Extensions Ajax4JSF, Dyno Faces, JSF Extensions • IDE Support IntelliJ, Eclipse, JDeveloper, Excadel Studio Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 13
  • 14. Architecture Controller • Model Config (faces-config.xml) • View • Controller Events Request (ValueChangeEvent, ActionEvent) Event Listeners & Front Servlet Action Handlers (FacesServlet) (ValueChangeListener, ActionListener) Component Tree Component Business (UIComponent) Model Objects (Java Beans) (Managed Beans) UIViewRoot Delegates UIForm (Convertors, Validators, Renderers) Response UIPanel UIInput UIInput Resources (JSP, XML, Properties) View Model Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 14
  • 15. Architecture Controller • Controller Config (faces-config.xml) • Front Servlet Request Events (ValueChangeEvent, ActionEvent) Event Listeners & • Configuration Front Servlet Action Handlers • Event Listeners (FacesServlet) (ValueChangeListener, ActionListener) Component Tree Component Business (UIComponent) Model Objects (Java Beans) (Managed Beans) UIViewRoot Delegates UIForm (Convertors, Validators, Renderers) Response UIPanel UIInput UIInput Resources (JSP, XML, Properties) View Model Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 15
  • 16. Architecture Controller • Model Config (faces-config.xml) • Business Objects Request Events (ValueChangeEvent, ActionEvent) Event Listeners & • POJO’s Front Servlet Action Handlers (FacesServlet) (ValueChangeListener, ActionListener) Component Tree Component Business (UIComponent) Model Objects (Java Beans) (Managed Beans) UIViewRoot Delegates UIForm (Convertors, Validators, Renderers) Response UIPanel UIInput UIInput Resources (JSP, XML, Properties) View Model Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 16
  • 17. Architecture Controller • View Config (faces-config.xml) • Component Tree Request Events (ValueChangeEvent, ActionEvent) Event Listeners & • Component Model Front Servlet Action Handlers • Delegates (FacesServlet) (ValueChangeListener, ActionListener) • Resources Component Tree Component Business (UIComponent) Model Objects (Java Beans) (Managed Beans) UIViewRoot Delegates UIForm (Convertors, Validators, Renderers) Response UIPanel UIInput UIInput Resources (JSP, XML, Properties) View Model Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 17
  • 18. Architecture Lifecycle Restore view Apply request values Process validations Update model values Invoke application Render response Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 18
  • 19. Architecture Example JSP with JSF tags Component Tree Markup ... UIViewRoot <f:fiew> HTML <h:form> <h:panelGrid columns = "2"> UIForm <h:inputText/> <h:inputSecret/> WML </panelGrid> UIPanel </h:form> </f:view> .. JSP XML UIInput UIInput Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 19
  • 20. JSF Evolution Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 20
  • 21. JSF Evolution History JSF 1.0 / 1.1 JSF 2 Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 21
  • 22. History JSF 1.0, 1.1 JSF 1.2 JSF 2.0 JSR 127 JSR 252 JSR 314 Servlet 2.3, JSP 1.2 Servlet 2.5, JSP 2.1 JSR Review Ballot: JSR Review Ballot: JSR Review Ballot: May 2001 August 2004 May 2007 Final Release 2: Final Release 2: Final Release 2: May 2004 May 2006 JEE6 – 4Q 2008 2004 2006 2008 ?? Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 22
  • 23. JSF 1.1 (JSR 127)‫‏‬ Shortcomings JSF – JSP Mismatch <h:commandLink action="foo"> Read between the lines Read between the lines <a href=“#” onClick=“…”></a> </h:commandLink> <h:commandLink action="foo"> <a href=“#” onClick=“…”> <h:outputText Read between the lines value="Read between the lines”/> </a> </h:commandLink> Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 23
  • 24. JSF 1.1 (JSR 127)‫‏‬ Shortcomings JSF – JSP Mismatch Different Lifecycle Writing to the same stream Limited EL Not compatible with JSP EL Forbidden nesting components (<c:forEach>)‫‏‬ Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 24
  • 25. JSF 1.2 (JSR 252)‫‏‬ JSP EL JSF EL Improvements New Content Interweaving Model JSP ViewHandler, JSP Base Tag class Unified EL Unified EL in JSTL (javax.el) Deferred evaluation Support get / set value Support method invocation Pluggable API for resolving expressions JSTL integration (<c:forEach>)‫‏‬ Back Button / Multi Frame Apps Message association Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 25
  • 26. JSF 1.2 (JSR 252)‫‏‬ Shortcomings Development Customizing components is complicated Exceptions are not descriptive No support for annotations Deployment Unnecessary deployment step Not JEE compliant (packaging, DI)‫‏‬ Components Missing / Limited components Security No security model (managed beans, resources)‫‏‬ Ajax Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 26
  • 27. Custom Components Let’s say we want a collapsible panel … Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 27
  • 28. Custom Components: JSF 1.2 UIComponentBase.java UIComponentTag.java extend UICollapse.java CollapseTag.java write collapse.tld faces-config.xml modify Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 28
  • 29. Custom Components: JSF 1.2 UICollapse.java Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 29
  • 30. Custom Components: JSF 1.2 CollapseTag.java Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 30
  • 31. Custom Components: JSF 1.2 collapse.tld Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 31
  • 32. Custom Components: JSF 1.2 faces-config.xml Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 32
  • 33. Custom Components: JSF 1.2 Too much wiring !!! Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 33
  • 34. Custom Components: Facelets collapse.xhtml Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 34
  • 35. Exceptions: JSF 1.2 No centralized exception handling Servlet filter Poor documentation “Silent error” Validation error No Exception No log output Need to use <h:messages/> Unified EL wraps exception Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 35
  • 36. Exceptions: JSF 1.2 exception.jsf <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> <f:view> <h:form> <h:inputText value="#{myBean.name}"/> </h:form> </f:view> MyBean.class public class MyBean { public String getName() { if(true) throw new RuntimeException("my exception"); return "line not reached"; } . . . } Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 36
  • 37. Exceptions: JSF 1.2 Instead of A stack trace dump javax.servlet.ServletException: javax/servlet/jsp/tagext/JspIdConsumer Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 37
  • 38. Exceptions: Facelets We should be getting Verbose description (location, tree, phase, variables)‫‏‬ javax.el.ELException: /exception.xhtml @7,40 value="#{myBean.name}": java.lang.RuntimeException Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 38
  • 39. Ajax: JSF 1.2 • Good: – Ajax “ready” – JSF component maintain state – Well defined req processing – Hides JS from page author • Bad: – No built-in support – No standard – Full view rendering – Incompatible comp. libraries Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 39
  • 40. Templating: JSF 1.2 • No standard support – <f:subview../> – <c:import…/> – <jsp:include …/> Header Nav Content Footer Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 40
  • 41. Community Reservations “… It is OK to learn things, but learning should be like series of "AHA!" moments and "WOW! they do that too!" exclamations. Learning JSF is series of WTF moments - and it should not be! …” “JSF Articles – Wish List for JSF 2.0 and more AJAX+JSF”, The Server Side, April 05, 2007 Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 41
  • 42. Community Reservations “… I download 1 framework and it should be complete. Don't tell me I need to download 5 other packages from various websites to make it actually useful??? …” “… JSF should not be like a mine-field. It should be fun to use. It should be impossible for a silent error to occur, and this is exactly what happens when you have a validation error but no corresponding h:message(s) tag. …” News / Comments -“JSF sucks...and has no hope” The Server Side, 2007 Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 42
  • 43. Community Wish List Facelets integration Client Side Validation Scoping Easier Development of components Simplify configuration Centralized Exception handling Navigation Rules API Hard failure … Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 43
  • 44. The Irony JSF defined a standard UI development has advanced JSF got “old” Many great ideas Many JSF extensions (to fill void)‫‏‬ New technologies Irony: Back to starting point Need for a new standard Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 44
  • 45. JSF 2.0 JSR 314 Ease of development Technology Adoption Features Performance Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 45
  • 46. JSR 314 Purpose Max. development productivity (IDE)‫‏‬ Min. maintenance complexity Integrate with other web tech. More responsive UI (Ajax)‫‏‬ Requirements Ease of development New Features & Fixes Performance & Scalability Technology Adoption Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 46
  • 47. JSR 314 Specification Lead Ed Burns Sun Microsystems, Inc. Roger Kitain Sun Microsystems, Inc. Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 47
  • 48. JSR 314 Milestones (anticipated): Stage Start Finish Author 1st Draft 7 Feb 07 9 Feb 07 2nd Draft Reviewed 15 Feb 07 9 Mar 07 Author 1st EG Public Draft 7 Mar 07 9 Mar 07 1st EG Public Draft Review 9 Mar 07 16 Mar 07 File JSR with JCP Apr 07 Apr 07 JSR Review Ballot Apr 07 May 07 EG Formation May 07 Aug 07 Early Draft Review Oct 07 Oct 07 Public Review Feb 08 Mar 08 Public Review Ballot Mar 08 Apr 08 Proposed Final Draft JavaEE6 Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 48
  • 49. JSR 314 Introducing the Experts Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 49
  • 50. Let the experts play Expert Group Kick-off Meeting Buy a Feature Will the community needs be met? Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 50
  • 51. Let the experts play (cont.) Feature List (partial): Name Feature Cost Facelets Templating, Component Aggregation 165 Zero Dep Eliminate Deployment Step 100 EZComp Simplify creation of customize 100 components Ajax Expand lifecycle to be aware of Ajax, 80 client lifecycle Errors Better error reporting 80 Listeners New listeners for lifecycle events 50 Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 51
  • 52. Let the experts play (cont.) Feature List (cont.): Name Feature Cost Config. No faces-confix.xml, no web.xml 50 Mostly Get Bookmarking, support got “GET” 80 Annotations Components, managed beans, 25 navigation rules Rendering Declarative rendering (no out.println)‫‏‬ 25 Fix State Default to stateless components 80 Skins Skinning / Themeing 60 Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 52
  • 53. Let the experts play (cont.) The Results: Name Number of units purchased Cost Ajax 5 80 Facelets 4 165 Annotations 4 25 State Saving 4 80 Validation++ 4 15 EZComp 3 100 Errors 3 80 Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 53
  • 54. JSF 2.0 JSR 314 Ease of development Technology Adoption Features Performance Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 54
  • 55. Ease Of Development Annotations Templating Component Aggregation Verbose Exceptions JSF Artifacts in WAR Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 55
  • 56. Ease Of Development Annotations Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 56
  • 57. Ease Of Development Annotations: JSF 1.2 • Tedious XML – faces-config.xml – Web.xml • JEE 5 Annotations – @EJB – @PersistenceContext –… Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 57
  • 58. Ease Of Development Annotations: JSF 2.0 • Artifacts – Managed beans @Property(el=true, saveState=true)‫‏‬ – Scope – Navigation Rules @Bean – Dependency Injection @PhaseListener – Converters @Converter – Validators • Zero Configuration • Skip deployment Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 58
  • 59. Ease Of Development Templating • Faceletes Header – Develop UI live • JSF Templating Nav Content – Pages, components • Struts Tiles Footer – Layouts – Screen definition – Inheritance Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 59
  • 60. JSF 2.0 JSR 314 Ease of development Technology Adoption Features Performance Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 60
  • 61. Technology Adoption Ajax Passing values between pages Skinning / Themeing Web Beans JSR 299 Client lifecycle / validation Server Side Scripting Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 61
  • 62. Technology Adoption Ajax: Page wide • Page wide support (region, zone)‫‏‬ • Add support to existing components • Sub view processing • Partial tree rendering • Normal lifecycle • Partial page refresh • Example: Ajax4Jsf, Dynamic Faces Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 62
  • 63. Technology Adoption Ajax: Component wide • Ajaxified components – Minimal Ajax awareness required • Example: – RichFaces, IceFaces, ADF (Trinidad)‫‏‬ RCFaces, Galileo Faces, Woodstock • Client validations • Client component interaction Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 63
  • 64. Technology Adoption Ajax example: Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 64
  • 65. Technology Adoption <f:view> Ajax4Jsf example: <h:outputText value="Ajax List Demo"/> <h:form> <h:panelGrid columns="2"> <h:panelGrid> <a4j:region> <h:outputText value="Country:"/> <h:selectOneListbox id="countryId"> <a4j:region> <f:selectItems value="#{myBean.countries}" /> <h:selectOneListbox id="countryId"> <f:selectItems value="#{myBean.countries}" /> <a4j:support event="onchange" reRender="cityId" <a4j:support event="onchange" reRender="cityId" action="#{myBean.changeCountry}" ajaxSingle="true"/> action="#{myBean.changeCountry}" ajaxSingle="true"/> </h:selectOneListbox> </h:selectOneListbox> </a4j:region> </a4j:region> </h:panelGrid> <h:panelGrid> <h:outputText value="City:"/> <h:selectOneListbox id="cityId"> <f:selectItems value="#{myBean.cities}" /> </h:selectOneListbox> </h:panelGrid> </h:panelGrid> <h:commandButton value="Submit" action="none" /> </h:form> </f:view> Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 65
  • 66. Technology Adoption Partial Page Submit Partial Tree Decode AjaxViewRoot UIOutput UIForm UIPanel UICommand UIPanel UIPanel UIOutput UISelectOne UIOutput UISelectOne Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 66
  • 67. Technology Adoption Partial Page Refresh Partial Tree Render AjaxViewRoot UIOutput UIForm UIPanel UICommand UIPanel UIPanel UIOutput UISelectOne UIOutput UISelectOne Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 67
  • 68. Technology Adoption Passing values between pages: JSF 1.2 Supported scopes Page, Session, Application State Client: Cookie, URL encoding, hidden field Server: HttpSession, ServletContext Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 68
  • 69. Technology Adoption Passing values between pages Dialog / Conversation / Process scope Example: JBoss Seam Apache Shale Spring WebFlow Oracle ADF Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 69
  • 70. Technology Adoption Skinning / Themeing Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 70
  • 71. Technology Adoption Skinning / Themeing • Changing component style – Dynamically – Instantly • Technologies – Oracle ADF Faces – Apache Trinidad – JBoss Rich Faces – Icesoft IceFaces Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 71
  • 72. Technology Adoption Skinning / Themeing • Example: Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 72
  • 73. JSF 2.0 JSR 314 Ease of development Technology Adoption New Features Performance Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 73
  • 74. New Features Separate build / render tree Bookmarking Additional standard components AJAX aware lifecycle Partial tree traversal Page actions Access to persistence store Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 74
  • 75. New Features Separate build / render tree Initial Request Render Response Phase Create Component Tree Render Tree Postback Request Restore View Phase Create Component Tree Render Response Phase Render Tree Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 75
  • 76. New Features Bookmarking JSF 1.2 No support in <h:form/> Command component don’t generate GET Use implicit “param” Enhanced Support for Http GET New lifecycle for non-faces request (init req)‫‏‬ Submitted values come from HTTP params not (input components)‫‏‬ Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 76
  • 77. New Features Additional standard components Current set is to weak Components from different vendors cannot coexist Date Picker File Upload Tree Tabbed Panel Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 77
  • 78. JSF 2.0 JSR 314 Ease of development Technology Adoption Features Performance Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 78
  • 79. Performance Save / restore page deltas ADF Client side component validations Inter client component interaction Example: Dual combo box Caching for rendering Improve PhaseListener Interceptor Filter requests Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 79
  • 80. Prolog The question should be: Not - will the community needs be met ? But, will the community needs be met - on time … ? Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 80
  • 81. Q&A Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 81
  • 82. Definition What is JSF ? A server side user interface component framework for Java technology based web applications. Sun J2EE 1.4 Tutorial A component-based, Web-tier UI framework Mastering JavaServer Faces, Wiley 2004 A component architecture A standard set of UI widgets An application infrastructure JavaServer Faces in Action, Manning 2005 A specification with implementations offered by multiple vendors A set of user interface (UI) components API for extending the standard components or developing new JavaServer‫‏‬Faces,‫‏‬O’Reilly‫4002‏‬ A set of prefabricated UI (user interface) components An event-driven programming model A component model that enables third-party developers to supply additional components Core JavaServer Faces, Sun 2007 Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 82
  • 83. Resources JSR Draft https://javaserverfaces-spec-public.dev.java.net/ proposals/JSF-2_0-draft.html JCP – JSR 314 http://jcp.org/en/jsr/detail?id=314 Ed Burns Blog http://weblogs.java.net/blog/edburns “The Requirements Scratchpad” http://wiki.java.net/bin/view/Projects/Jsf2RequirementsScratchpad Community Forums & Blogs Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 83
  • 84. Wish List Pre-JCP-filed draft for JavaServer Faces 2.0 JSR / Ed Burns http://weblogs.java.net/blog/edburns JSF 2.0 requirements scratchpad http://wiki.java.net JSF 2.0 is Here! http://www.oreillynet.com/onjava JSF 2.0 Wish List Part 1 / Kito Man http://www.jsfcentral.com EE6 wishlist part II: JSF / Gavin King http://in.relation.to JSF 2.0 Begins … Copyright AlphaCSP Israel 2007 - The JavaEdge Seminar 84