SlideShare una empresa de Scribd logo
1 de 40
Descargar para leer sin conexión
<Insert Picture Here>




Java Server Faces 2.0
Arun Gupta, JavaEE & GlassFish Guy
blogs.oracle.com/arungupta, @arungupta
The following is intended to outline our general product
direction. It is intended for information purposes only,
and may not be incorporated into any contract. It is
not a commitment to deliver any material, code, or
functionality, and should not be relied upon in making
purchasing decisions.
The development, release, and timing of any features
or functionality described for Oracle’s products remains
at the sole discretion of Oracle.


                                                           2
Java Server Faces 2.0

• JSR 314
• Focus
  –   Ease-of-development
  –   New features
  –   Runtime Performance & Scalability
  –   Adoption




                                          3
JSF2 – Ease of development

• Real-world view description technology
  – Facelets
• Custom component with little/no Java coding
• “faces-config.xml” / “web.xml” optional
  – Annotations
• No JSP tag handler for components
• Improved developer experience by reporting project stage
• Make it easy to create CRUD-based apps


                                                             4
Facelets
• Designed for JSF from beginning
• XHTML + CSS
  – Document validation
• Better error handling, including line numbers
• Library prefixes as namespaces
• EL directly in page:
  – #{bean.propertyname}
• Templating made easy
  – ui:composition, ui:define, ui:insert
  – ui:include, ui:repeat

                                                  5
Facelets – Sample Code

<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:h="http://java.sun.com/jsf/html">
  <h:head>
    <title>Enter Name &amp; Password</title>
  </h:head>
  <h:body>
    <h1>Enter Name &amp; Password</h1>
    <h:form>
      <h:panelGrid columns="2">
        <h:outputText value="Name:"/>
        <h:inputText value="#{simplebean.name}" title="name"
                     id="name" required="true"/>
        <h:outputText value="Password:"/>
        <h:inputText value="#{simplebean.password}" title="password"
                     id="password" required="true"/>
      </h:panelGrid>
      <h:commandButton action="show" value="submit"/>
    </h:form>
  </h:body>
</html>



                                                                       6
Composite Components

• Enable True Abstraction
  – Create a true, reusable, component from an arbitrary region of a
    page
  – Built by composing other components
• “Using” and “Defining” page
• Full support for using attached objects in the using page
  – Action methods
  – Validators, etc




                                                                       7
Composite Components in JSF 1.x ...




                                      8
Becomes this...




                  9
Or maybe this:




                 10
Composite Components – Sample Code




                                     11
Composite Component – Sample Code
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:h="http://java.sun.com/jsf/html">
  <h:head>
    <title>Enter Name &amp; Password</title>
  </h:head>
  <h:body>
    <h1>Enter Name &amp; Password</h1>
    <h:form>
      <h:panelGrid columns="2">
        <h:outputText value="Name:"/>
        <h:inputText value="#{simplebean.name}" title="name"
                     id="name" required="true"/>
        <h:outputText value="Password:"/>
        <h:inputText value="#{simplebean.password}" title="password"
                     id="password" required="true"/>
      </h:panelGrid>
      <h:commandButton action="show" value="submit"/>
    </h:form>
  </h:body>
</html>




                                                                       12
Composite Components – Mapping
 <html xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://java.sun.com/jsf/facelets"
   xmlns:h="http://java.sun.com/jsf/html"
   xmlns:ez="http://java.sun.com/jsf/composite/ezcomp">
   <h:head>
     <title>Enter Name &amp; Password</title>
   </h:head>
   <h:body>
     <h1>Enter Name &amp; Password</h1>
     <h:form>
       <ez:username-password/>
       <h:commandButton action="show" value="submit"/>
     </h:form>
   </h:body>
 </html>                                          . . .
                                                  WEB-INF
                                                  index.xhtml
                                                  resources/
                                                    ezcomp/
                                                       username-password.xhtml

              http://blogs.oracle.com/arungupta/entry/totd_147_java_server_faces


                                                                                   13
Optional “faces-config.xml”

• <managed-bean> → @ManagedBean or @Named
  – Validator, Renderer, Listener, ...
• Implicit navigation rules – match a view on the disk
  – Conditional navigation

 @Named(“simplebean”)
 public class SimpleBean {
 . . .
 }

 <h:commandButton action="show" value="submit"/>


                                                         14
Optional “web.xml”
@SuppressWarnings({"UnusedDeclaration"})
@HandlesTypes({
      ManagedBean.class,
      FacesComponent.class,
      FacesValidator.class,
      FacesConverter.class,
      FacesBehaviorRenderer.class,
      ResourceDependency.class,
      ResourceDependencies.class,
      ListenerFor.class,
      ListenersFor.class,
      UIComponent.class,
      Validator.class,
      Converter.class,
      Renderer.class
})
public class FacesInitializer implements ServletContainerInitializer {
    // NOTE: Loggins should not be used with this class.
    private static final String FACES_SERVLET_CLASS = FacesServlet.class.getName();




                                                                                      15
Optional “web.xml”


public void onStartup(Set<Class<?>> classes, ServletContext servletContext)
          throws ServletException {
        if (shouldCheckMappings(classes, servletContext)) {
            Map<String,? extends ServletRegistration> existing =
servletContext.getServletRegistrations();
            for (ServletRegistration registration : existing.values()) {
                if (FACES_SERVLET_CLASS.equals(registration.getClassName())) {
                    // FacesServlet has already been defined, so we're
                    // not going to add additional mappings;
                    return;
                }
            }
            ServletRegistration reg =
                  servletContext.addServlet("FacesServlet",
                                            "javax.faces.webapp.FacesServlet");
            reg.addMapping("/faces/*", "*.jsf", "*.faces");
            servletContext.setAttribute(RIConstants.FACES_INITIALIZER_MAPPINGS_ADDED,
Boolean.TRUE);



                                                                                        16
Project Stage


• Inspired by Rails
• Development
  – Better error reporting, debugging
• Production
  – Better performance




                                        17
CRUD-based Applications




                          18
JSF2 – New features

• Integrated Ajax
     – Partial tree traversal
•   HTTP GET support
•   Form-level validation
•   Bundling/delivering static resources with a component
•   System Events




                                                            19
Integrated Ajax

• Inspiration – ADF, RichFaces, IceFaces, DynamicFaces
• Two entry points:
  – Declarative: <f:ajax> tag, uses AjaxBehavior
  – Programmatic ajax
    • resource library javax.faces
    • resource name jsf.js
    • JavaScript namespace jsf.ajax.
       – jsf.ajax.request function




                                                         20
Integrated Ajax – Sample Code



<h:commandButton
      actionListener="#{sakilabean.findActors}"
      value="submit">
      <f:ajax execute="length" render="actorTable totalActors"/>
</h:commandButton>




     http://blogs.oracle.com/arungupta/entry/totd_123_f_ajax_bean


                                                                    21
HTTP GET Support

• GET Request handling required low-level primitives
  – PhasesListener
• Now first-class support in JSF2
  – View Parameters
  – Bookmarkable URLs
     • <h:link>/<h:button>




                                                       22
JSF2 GET – View Parameters

• Declarative way to map request parameters to EL-reachable
  location/model property
  – <f:metadata>/<f:viewParam>
• Only for Facelets
• Faces lifecycle for GET
  – Converted to proper target type
  – Validated before assignment
  – Pushed into the model
• Converters/validators can be attached to <f:viewParam>


                                                              23
View Parameters – Sample Code

@Named
public class Blog {
    int entryId;
    . . .
}

<f:metadata>                                         page1.xhtml
  <f:viewParam name="id" value="#{blog.entryId}"/>
</f:metadata>

page1.xhtml?id=10


blog.entryId will equal “10”




                                                                   24
JSF2 GET – Bookmarkable URLs


<h:link outcome="viewEntry" value="Link">

 <f:param name="entry" value="#{aBean.entry}"/>

</h:link>




 <a href="http://localhost:8080/myapp/viewEntry.xhtml?entry=entry1">Link</a>




                                                                         25
Validation

• Integration with JSR 303: Bean Validation
  – @NotEmpty String name;
  – Default validator: javax.faces.Bean – automatically applied to all input
    fields
• Use cases
  – Ordering constraints using Validation Groups
    • Basic/Cheap constraints before complex/costly ones
  – Partial data validation: wizard-style form
• Error messages are translated to FacesMessages


                                                                          26
Validation – Sample Code

<h:inputText value="#{address.zip}">
  <f:validateBean validationGroups="myGroup"/>
</h:inputText>


<h:input id="zip" value="#{address.zip}">
    <f:validateRequired />
</h:input>
<h:input id="zip" value="#{address.zip}" required=”true”/>


<h:input id="zip" value="#{address.zip}">
  <f:validateRegex pattern="/^d{5}([-]d{4})?$/" />
</h:input>


                                                             27
Resources

• Standard way to serve image, JavaScripts, CSS, …
  – /resources or /META-INF/resources
  – No need for separate Servlet or Filter
  – Logically related to components, treat them that way
• @ResourceDependency or @ResourceDependencies on
  custom components
  – @ResourceDependency(library=”corporate”,
    name=”colorAndMedia.css”)




                                                           28
Resource EL – Sample Code

• Syntax
  – #{resource['<resource>']}
  – #{resource['<library>:<resource>']}
• Examples of use
  – <a href="#{resource['header.jpg']}"/>
  – <h:graphicImage value="#{resource['corp:header.jpg']}"/>




                                                               29
System Events

• Inspired by Solaris Dtrace, Linux strace, etc.
• Publish/Subscribe event bus for things that happen during the
  JSF Lifecycle
• Adds to event listening abilities
  – FacesEvent → FacesListener (existing)
  – PhaseEvent → PhaseListener (existing)
  – SystemEvent → SystemEventListener (new)
• Mainly targeted at page/component/framework authors



                                                                  30
System Event Types




                     31
System Events – Sample Code


<h:inputText>
    <f:event type="preValidate"
        listener="#{bean.doSomePreValidation}"/>
</h:inputText>



<h:inputText value="#{myBean.text}">
    <f:event type="beforeRender"
         listener="#{myBean.beforeTextRender}"/>
</h:inputText>




                                                   32
JSF2 – Runtime Performance & Scalability

• Behavior
• Partial State Saving




                                           33
Behaviors

• New type of “attached object” that enhance the component's
  client-side functionality
  – Unlike server-side Validator/Renderer
  – Use cases: Client-side validation, Animations and visual effects, Alerts
    and confirmation dialogs, Tooltips
• 3 new behaviors
  – ClientBehavior
  – ClientBehaviorHolder
  – AjaxBehavior
    • f:ajax is AjaxBehavior


                                                                               34
Behaviors


                               implements      ClientBehaviorHolder
              UI Component
                                            addClientBehavior(eventName, behavior)




                                                    ClientBehavior
                                                          getScript()



• Loose Coupling
  – Client behaviors product scripts in a component-agnostic manner
  – Components retrieve scripts/insert into markup in a behavior-agnostic
    manner


                                                                                     35
Behaviors – Sample Code


public class MyBehavior implements ClientBehavior {
   public String getScript(ClientBehaviorContext context) {
      return "return confirm('Really???')";
   }
}

<h:commandLink
    onclick="return confirm('Really???')"/>



<h:commandLink>
    <foo:confirm event="click"/>
</h:commandLink>



                                                              36
Partial State Saving

• Inspired by Trinidad state saving
• Save only the state that's changed since creation of the
  component tree
  – Initial state can be restored by re-executing the view
• Per-view state size up to 4X smaller
• Default for pages written with Facelets
• Implemented in standard components
  – Default for composite components



                                                             37
JSF 2.2
 http://jcp.org/en/jsr/detail?id=344
                                                  NEW


• Ease of development
    – cc:interface is optional
    – JSF lifecycle is CDI aware
    – Runtime configuration options change
• Support implementation of Portlet Bridge 2.0
• Support for HTML5 features
    – Forms, Heading/Section content model, ...
• New components like FileUpload and BackButton


                                                        38
References


•   oracle.com/javaee
•   glassfish.org
•   oracle.com/goto/glassfish
•   blogs.oracle.com/theaquarium
•   youtube.com/GlassFishVideos
•   Follow @glassfish




                                   39
<Insert Picture Here>




Java Server Faces 2.0
Arun Gupta, JavaEE & GlassFish Guy
blogs.oracle.com/arungupta, @arungupta

Más contenido relacionado

La actualidad más candente

Java Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAXJava Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAXIMC Institute
 
Javatwo2012 java frameworkcomparison
Javatwo2012 java frameworkcomparisonJavatwo2012 java frameworkcomparison
Javatwo2012 java frameworkcomparisonJini Lee
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPOscar Merida
 
PrimeTime JSF with PrimeFaces - Dec 2014
PrimeTime JSF with PrimeFaces - Dec 2014PrimeTime JSF with PrimeFaces - Dec 2014
PrimeTime JSF with PrimeFaces - Dec 2014cagataycivici
 
Spring Web Flow. A little flow of happiness.
Spring Web Flow. A little flow of happiness.Spring Web Flow. A little flow of happiness.
Spring Web Flow. A little flow of happiness.Alex Tumanoff
 
Templates
TemplatesTemplates
Templatessoon
 
In The Brain of Cagatay Civici: Exploring JavaServer Faces 2.0 and PrimeFaces
In The Brain of Cagatay Civici: Exploring JavaServer Faces 2.0 and PrimeFaces In The Brain of Cagatay Civici: Exploring JavaServer Faces 2.0 and PrimeFaces
In The Brain of Cagatay Civici: Exploring JavaServer Faces 2.0 and PrimeFaces Skills Matter
 
Integration of Backbone.js with Spring 3.1
Integration of Backbone.js with Spring 3.1Integration of Backbone.js with Spring 3.1
Integration of Backbone.js with Spring 3.1Michał Orman
 
Lap trinh web [Slide jsp]
Lap trinh web [Slide jsp]Lap trinh web [Slide jsp]
Lap trinh web [Slide jsp]Tri Nguyen
 
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...Uniface
 
Spring Web Webflow
Spring Web WebflowSpring Web Webflow
Spring Web WebflowEmprovise
 
Rest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.jsRest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.jsCarol McDonald
 
Lecture 2: Servlets
Lecture 2:  ServletsLecture 2:  Servlets
Lecture 2: ServletsFahad Golra
 
Java Web Programming [2/9] : Servlet Basic
Java Web Programming [2/9] : Servlet BasicJava Web Programming [2/9] : Servlet Basic
Java Web Programming [2/9] : Servlet BasicIMC Institute
 
Primefaces Confess 2012
Primefaces Confess 2012Primefaces Confess 2012
Primefaces Confess 2012cagataycivici
 
Building and managing java projects with maven part-III
Building and managing java projects with maven part-IIIBuilding and managing java projects with maven part-III
Building and managing java projects with maven part-IIIprinceirfancivil
 
Spring 3 - Der dritte Frühling
Spring 3 - Der dritte FrühlingSpring 3 - Der dritte Frühling
Spring 3 - Der dritte FrühlingThorsten Kamann
 

La actualidad más candente (20)

Java Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAXJava Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAX
 
Javatwo2012 java frameworkcomparison
Javatwo2012 java frameworkcomparisonJavatwo2012 java frameworkcomparison
Javatwo2012 java frameworkcomparison
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHP
 
PrimeTime JSF with PrimeFaces - Dec 2014
PrimeTime JSF with PrimeFaces - Dec 2014PrimeTime JSF with PrimeFaces - Dec 2014
PrimeTime JSF with PrimeFaces - Dec 2014
 
Spring Web Flow. A little flow of happiness.
Spring Web Flow. A little flow of happiness.Spring Web Flow. A little flow of happiness.
Spring Web Flow. A little flow of happiness.
 
Templates
TemplatesTemplates
Templates
 
Jsp Notes
Jsp NotesJsp Notes
Jsp Notes
 
In The Brain of Cagatay Civici: Exploring JavaServer Faces 2.0 and PrimeFaces
In The Brain of Cagatay Civici: Exploring JavaServer Faces 2.0 and PrimeFaces In The Brain of Cagatay Civici: Exploring JavaServer Faces 2.0 and PrimeFaces
In The Brain of Cagatay Civici: Exploring JavaServer Faces 2.0 and PrimeFaces
 
Integration of Backbone.js with Spring 3.1
Integration of Backbone.js with Spring 3.1Integration of Backbone.js with Spring 3.1
Integration of Backbone.js with Spring 3.1
 
Lap trinh web [Slide jsp]
Lap trinh web [Slide jsp]Lap trinh web [Slide jsp]
Lap trinh web [Slide jsp]
 
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...
 
Spring Web Webflow
Spring Web WebflowSpring Web Webflow
Spring Web Webflow
 
Rest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.jsRest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.js
 
Lecture 2: Servlets
Lecture 2:  ServletsLecture 2:  Servlets
Lecture 2: Servlets
 
Java Web Programming [2/9] : Servlet Basic
Java Web Programming [2/9] : Servlet BasicJava Web Programming [2/9] : Servlet Basic
Java Web Programming [2/9] : Servlet Basic
 
Primefaces Confess 2012
Primefaces Confess 2012Primefaces Confess 2012
Primefaces Confess 2012
 
Building and managing java projects with maven part-III
Building and managing java projects with maven part-IIIBuilding and managing java projects with maven part-III
Building and managing java projects with maven part-III
 
Java Server Faces
Java Server FacesJava Server Faces
Java Server Faces
 
Maven II
Maven IIMaven II
Maven II
 
Spring 3 - Der dritte Frühling
Spring 3 - Der dritte FrühlingSpring 3 - Der dritte Frühling
Spring 3 - Der dritte Frühling
 

Destacado

Deep Dive Hands-on in Java EE 6 - Oredev 2010
Deep Dive Hands-on in Java EE 6 - Oredev 2010Deep Dive Hands-on in Java EE 6 - Oredev 2010
Deep Dive Hands-on in Java EE 6 - Oredev 2010Arun Gupta
 
The Java EE 7 Platform: Productivity++ & Embracing HTML5
The Java EE 7 Platform: Productivity++ & Embracing HTML5The Java EE 7 Platform: Productivity++ & Embracing HTML5
The Java EE 7 Platform: Productivity++ & Embracing HTML5Arun Gupta
 
Java EE 6 = Less Code + More Power
Java EE 6 = Less Code + More PowerJava EE 6 = Less Code + More Power
Java EE 6 = Less Code + More PowerArun Gupta
 
GlassFish 3.1 – Simplifying your Java EE 6 Development and Deployment @ JAX L...
GlassFish 3.1 – Simplifying your Java EE 6 Development and Deployment @ JAX L...GlassFish 3.1 – Simplifying your Java EE 6 Development and Deployment @ JAX L...
GlassFish 3.1 – Simplifying your Java EE 6 Development and Deployment @ JAX L...Arun Gupta
 
Understanding the nuts & bolts of Java EE 6
Understanding the nuts & bolts of Java EE 6Understanding the nuts & bolts of Java EE 6
Understanding the nuts & bolts of Java EE 6Arun Gupta
 
Java EE 7: Boosting Productivity and Embracing HTML5
Java EE 7: Boosting Productivity and Embracing HTML5Java EE 7: Boosting Productivity and Embracing HTML5
Java EE 7: Boosting Productivity and Embracing HTML5Arun Gupta
 

Destacado (6)

Deep Dive Hands-on in Java EE 6 - Oredev 2010
Deep Dive Hands-on in Java EE 6 - Oredev 2010Deep Dive Hands-on in Java EE 6 - Oredev 2010
Deep Dive Hands-on in Java EE 6 - Oredev 2010
 
The Java EE 7 Platform: Productivity++ & Embracing HTML5
The Java EE 7 Platform: Productivity++ & Embracing HTML5The Java EE 7 Platform: Productivity++ & Embracing HTML5
The Java EE 7 Platform: Productivity++ & Embracing HTML5
 
Java EE 6 = Less Code + More Power
Java EE 6 = Less Code + More PowerJava EE 6 = Less Code + More Power
Java EE 6 = Less Code + More Power
 
GlassFish 3.1 – Simplifying your Java EE 6 Development and Deployment @ JAX L...
GlassFish 3.1 – Simplifying your Java EE 6 Development and Deployment @ JAX L...GlassFish 3.1 – Simplifying your Java EE 6 Development and Deployment @ JAX L...
GlassFish 3.1 – Simplifying your Java EE 6 Development and Deployment @ JAX L...
 
Understanding the nuts & bolts of Java EE 6
Understanding the nuts & bolts of Java EE 6Understanding the nuts & bolts of Java EE 6
Understanding the nuts & bolts of Java EE 6
 
Java EE 7: Boosting Productivity and Embracing HTML5
Java EE 7: Boosting Productivity and Embracing HTML5Java EE 7: Boosting Productivity and Embracing HTML5
Java EE 7: Boosting Productivity and Embracing HTML5
 

Similar a JavaServer Faces 2.0 - JavaOne India 2011

Rich Portlet Development in uPortal
Rich Portlet Development in uPortalRich Portlet Development in uPortal
Rich Portlet Development in uPortalJennifer Bourey
 
Primefaces Nextgen Lju
Primefaces Nextgen LjuPrimefaces Nextgen Lju
Primefaces Nextgen LjuSkills Matter
 
Primefaces Nextgen Lju
Primefaces Nextgen LjuPrimefaces Nextgen Lju
Primefaces Nextgen LjuSkills Matter
 
Step By Step Guide For Buidling Simple Struts App
Step By Step Guide For Buidling Simple Struts AppStep By Step Guide For Buidling Simple Struts App
Step By Step Guide For Buidling Simple Struts AppSyed Shahul
 
AnkaraJUG Kasım 2012 - PrimeFaces
AnkaraJUG Kasım 2012 - PrimeFacesAnkaraJUG Kasım 2012 - PrimeFaces
AnkaraJUG Kasım 2012 - PrimeFacesAnkara JUG
 
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010Arun Gupta
 
What You Need To Build Cool Enterprise Applications With JSF
What You Need To Build Cool Enterprise Applications With JSFWhat You Need To Build Cool Enterprise Applications With JSF
What You Need To Build Cool Enterprise Applications With JSFMax Katz
 
Rails 6 frontend frameworks
Rails 6 frontend frameworksRails 6 frontend frameworks
Rails 6 frontend frameworksEric Guo
 
jQuery and Rails: Best Friends Forever
jQuery and Rails: Best Friends ForeverjQuery and Rails: Best Friends Forever
jQuery and Rails: Best Friends Foreverstephskardal
 
JavaOne India 2011 - Servlets 3.0
JavaOne India 2011 - Servlets 3.0JavaOne India 2011 - Servlets 3.0
JavaOne India 2011 - Servlets 3.0Arun Gupta
 
Web applications with Catalyst
Web applications with CatalystWeb applications with Catalyst
Web applications with Catalystsvilen.ivanov
 
ASP.NET Overview - Alvin Lau
ASP.NET Overview - Alvin LauASP.NET Overview - Alvin Lau
ASP.NET Overview - Alvin LauSpiffy
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...Fabio Franzini
 
How to replace rails asset pipeline with webpack?
How to replace rails asset pipeline with webpack?How to replace rails asset pipeline with webpack?
How to replace rails asset pipeline with webpack?Tomasz Bak
 
Java Web Development with Stripes
Java Web Development with StripesJava Web Development with Stripes
Java Web Development with StripesSamuel Santos
 
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...SPTechCon
 
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...SPTechCon
 

Similar a JavaServer Faces 2.0 - JavaOne India 2011 (20)

Rich Portlet Development in uPortal
Rich Portlet Development in uPortalRich Portlet Development in uPortal
Rich Portlet Development in uPortal
 
Primefaces Nextgen Lju
Primefaces Nextgen LjuPrimefaces Nextgen Lju
Primefaces Nextgen Lju
 
Primefaces Nextgen Lju
Primefaces Nextgen LjuPrimefaces Nextgen Lju
Primefaces Nextgen Lju
 
The Rails Way
The Rails WayThe Rails Way
The Rails Way
 
Step By Step Guide For Buidling Simple Struts App
Step By Step Guide For Buidling Simple Struts AppStep By Step Guide For Buidling Simple Struts App
Step By Step Guide For Buidling Simple Struts App
 
AnkaraJUG Kasım 2012 - PrimeFaces
AnkaraJUG Kasım 2012 - PrimeFacesAnkaraJUG Kasım 2012 - PrimeFaces
AnkaraJUG Kasım 2012 - PrimeFaces
 
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010
 
What You Need To Build Cool Enterprise Applications With JSF
What You Need To Build Cool Enterprise Applications With JSFWhat You Need To Build Cool Enterprise Applications With JSF
What You Need To Build Cool Enterprise Applications With JSF
 
Rails 6 frontend frameworks
Rails 6 frontend frameworksRails 6 frontend frameworks
Rails 6 frontend frameworks
 
jQuery and Rails: Best Friends Forever
jQuery and Rails: Best Friends ForeverjQuery and Rails: Best Friends Forever
jQuery and Rails: Best Friends Forever
 
JavaOne India 2011 - Servlets 3.0
JavaOne India 2011 - Servlets 3.0JavaOne India 2011 - Servlets 3.0
JavaOne India 2011 - Servlets 3.0
 
Jsf2.0 -4
Jsf2.0 -4Jsf2.0 -4
Jsf2.0 -4
 
Asp.net
Asp.netAsp.net
Asp.net
 
Web applications with Catalyst
Web applications with CatalystWeb applications with Catalyst
Web applications with Catalyst
 
ASP.NET Overview - Alvin Lau
ASP.NET Overview - Alvin LauASP.NET Overview - Alvin Lau
ASP.NET Overview - Alvin Lau
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
 
How to replace rails asset pipeline with webpack?
How to replace rails asset pipeline with webpack?How to replace rails asset pipeline with webpack?
How to replace rails asset pipeline with webpack?
 
Java Web Development with Stripes
Java Web Development with StripesJava Web Development with Stripes
Java Web Development with Stripes
 
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
 
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
 

Más de Arun Gupta

5 Skills To Force Multiply Technical Talents.pdf
5 Skills To Force Multiply Technical Talents.pdf5 Skills To Force Multiply Technical Talents.pdf
5 Skills To Force Multiply Technical Talents.pdfArun Gupta
 
Machine Learning using Kubernetes - AI Conclave 2019
Machine Learning using Kubernetes - AI Conclave 2019Machine Learning using Kubernetes - AI Conclave 2019
Machine Learning using Kubernetes - AI Conclave 2019Arun Gupta
 
Machine Learning using Kubeflow and Kubernetes
Machine Learning using Kubeflow and KubernetesMachine Learning using Kubeflow and Kubernetes
Machine Learning using Kubeflow and KubernetesArun Gupta
 
Secure and Fast microVM for Serverless Computing using Firecracker
Secure and Fast microVM for Serverless Computing using FirecrackerSecure and Fast microVM for Serverless Computing using Firecracker
Secure and Fast microVM for Serverless Computing using FirecrackerArun Gupta
 
Building Java in the Open - j.Day at OSCON 2019
Building Java in the Open - j.Day at OSCON 2019Building Java in the Open - j.Day at OSCON 2019
Building Java in the Open - j.Day at OSCON 2019Arun Gupta
 
Why Amazon Cares about Open Source
Why Amazon Cares about Open SourceWhy Amazon Cares about Open Source
Why Amazon Cares about Open SourceArun Gupta
 
Machine learning using Kubernetes
Machine learning using KubernetesMachine learning using Kubernetes
Machine learning using KubernetesArun Gupta
 
Building Cloud Native Applications
Building Cloud Native ApplicationsBuilding Cloud Native Applications
Building Cloud Native ApplicationsArun Gupta
 
Chaos Engineering with Kubernetes
Chaos Engineering with KubernetesChaos Engineering with Kubernetes
Chaos Engineering with KubernetesArun Gupta
 
How to be a mentor to bring more girls to STEAM
How to be a mentor to bring more girls to STEAMHow to be a mentor to bring more girls to STEAM
How to be a mentor to bring more girls to STEAMArun Gupta
 
Java in a World of Containers - DockerCon 2018
Java in a World of Containers - DockerCon 2018Java in a World of Containers - DockerCon 2018
Java in a World of Containers - DockerCon 2018Arun Gupta
 
The Serverless Tidal Wave - SwampUP 2018 Keynote
The Serverless Tidal Wave - SwampUP 2018 KeynoteThe Serverless Tidal Wave - SwampUP 2018 Keynote
The Serverless Tidal Wave - SwampUP 2018 KeynoteArun Gupta
 
Introduction to Amazon EKS - KubeCon 2018
Introduction to Amazon EKS - KubeCon 2018Introduction to Amazon EKS - KubeCon 2018
Introduction to Amazon EKS - KubeCon 2018Arun Gupta
 
Mastering Kubernetes on AWS - Tel Aviv Summit
Mastering Kubernetes on AWS - Tel Aviv SummitMastering Kubernetes on AWS - Tel Aviv Summit
Mastering Kubernetes on AWS - Tel Aviv SummitArun Gupta
 
Top 10 Technology Trends Changing Developer's Landscape
Top 10 Technology Trends Changing Developer's LandscapeTop 10 Technology Trends Changing Developer's Landscape
Top 10 Technology Trends Changing Developer's LandscapeArun Gupta
 
Container Landscape in 2017
Container Landscape in 2017Container Landscape in 2017
Container Landscape in 2017Arun Gupta
 
Java EE and NoSQL using JBoss EAP 7 and OpenShift
Java EE and NoSQL using JBoss EAP 7 and OpenShiftJava EE and NoSQL using JBoss EAP 7 and OpenShift
Java EE and NoSQL using JBoss EAP 7 and OpenShiftArun Gupta
 
Docker, Kubernetes, and Mesos recipes for Java developers
Docker, Kubernetes, and Mesos recipes for Java developersDocker, Kubernetes, and Mesos recipes for Java developers
Docker, Kubernetes, and Mesos recipes for Java developersArun Gupta
 
Thanks Managers!
Thanks Managers!Thanks Managers!
Thanks Managers!Arun Gupta
 
Migrate your traditional VM-based Clusters to Containers
Migrate your traditional VM-based Clusters to ContainersMigrate your traditional VM-based Clusters to Containers
Migrate your traditional VM-based Clusters to ContainersArun Gupta
 

Más de Arun Gupta (20)

5 Skills To Force Multiply Technical Talents.pdf
5 Skills To Force Multiply Technical Talents.pdf5 Skills To Force Multiply Technical Talents.pdf
5 Skills To Force Multiply Technical Talents.pdf
 
Machine Learning using Kubernetes - AI Conclave 2019
Machine Learning using Kubernetes - AI Conclave 2019Machine Learning using Kubernetes - AI Conclave 2019
Machine Learning using Kubernetes - AI Conclave 2019
 
Machine Learning using Kubeflow and Kubernetes
Machine Learning using Kubeflow and KubernetesMachine Learning using Kubeflow and Kubernetes
Machine Learning using Kubeflow and Kubernetes
 
Secure and Fast microVM for Serverless Computing using Firecracker
Secure and Fast microVM for Serverless Computing using FirecrackerSecure and Fast microVM for Serverless Computing using Firecracker
Secure and Fast microVM for Serverless Computing using Firecracker
 
Building Java in the Open - j.Day at OSCON 2019
Building Java in the Open - j.Day at OSCON 2019Building Java in the Open - j.Day at OSCON 2019
Building Java in the Open - j.Day at OSCON 2019
 
Why Amazon Cares about Open Source
Why Amazon Cares about Open SourceWhy Amazon Cares about Open Source
Why Amazon Cares about Open Source
 
Machine learning using Kubernetes
Machine learning using KubernetesMachine learning using Kubernetes
Machine learning using Kubernetes
 
Building Cloud Native Applications
Building Cloud Native ApplicationsBuilding Cloud Native Applications
Building Cloud Native Applications
 
Chaos Engineering with Kubernetes
Chaos Engineering with KubernetesChaos Engineering with Kubernetes
Chaos Engineering with Kubernetes
 
How to be a mentor to bring more girls to STEAM
How to be a mentor to bring more girls to STEAMHow to be a mentor to bring more girls to STEAM
How to be a mentor to bring more girls to STEAM
 
Java in a World of Containers - DockerCon 2018
Java in a World of Containers - DockerCon 2018Java in a World of Containers - DockerCon 2018
Java in a World of Containers - DockerCon 2018
 
The Serverless Tidal Wave - SwampUP 2018 Keynote
The Serverless Tidal Wave - SwampUP 2018 KeynoteThe Serverless Tidal Wave - SwampUP 2018 Keynote
The Serverless Tidal Wave - SwampUP 2018 Keynote
 
Introduction to Amazon EKS - KubeCon 2018
Introduction to Amazon EKS - KubeCon 2018Introduction to Amazon EKS - KubeCon 2018
Introduction to Amazon EKS - KubeCon 2018
 
Mastering Kubernetes on AWS - Tel Aviv Summit
Mastering Kubernetes on AWS - Tel Aviv SummitMastering Kubernetes on AWS - Tel Aviv Summit
Mastering Kubernetes on AWS - Tel Aviv Summit
 
Top 10 Technology Trends Changing Developer's Landscape
Top 10 Technology Trends Changing Developer's LandscapeTop 10 Technology Trends Changing Developer's Landscape
Top 10 Technology Trends Changing Developer's Landscape
 
Container Landscape in 2017
Container Landscape in 2017Container Landscape in 2017
Container Landscape in 2017
 
Java EE and NoSQL using JBoss EAP 7 and OpenShift
Java EE and NoSQL using JBoss EAP 7 and OpenShiftJava EE and NoSQL using JBoss EAP 7 and OpenShift
Java EE and NoSQL using JBoss EAP 7 and OpenShift
 
Docker, Kubernetes, and Mesos recipes for Java developers
Docker, Kubernetes, and Mesos recipes for Java developersDocker, Kubernetes, and Mesos recipes for Java developers
Docker, Kubernetes, and Mesos recipes for Java developers
 
Thanks Managers!
Thanks Managers!Thanks Managers!
Thanks Managers!
 
Migrate your traditional VM-based Clusters to Containers
Migrate your traditional VM-based Clusters to ContainersMigrate your traditional VM-based Clusters to Containers
Migrate your traditional VM-based Clusters to Containers
 

Último

Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 

Último (20)

Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 

JavaServer Faces 2.0 - JavaOne India 2011

  • 1. <Insert Picture Here> Java Server Faces 2.0 Arun Gupta, JavaEE & GlassFish Guy blogs.oracle.com/arungupta, @arungupta
  • 2. The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 2
  • 3. Java Server Faces 2.0 • JSR 314 • Focus – Ease-of-development – New features – Runtime Performance & Scalability – Adoption 3
  • 4. JSF2 – Ease of development • Real-world view description technology – Facelets • Custom component with little/no Java coding • “faces-config.xml” / “web.xml” optional – Annotations • No JSP tag handler for components • Improved developer experience by reporting project stage • Make it easy to create CRUD-based apps 4
  • 5. Facelets • Designed for JSF from beginning • XHTML + CSS – Document validation • Better error handling, including line numbers • Library prefixes as namespaces • EL directly in page: – #{bean.propertyname} • Templating made easy – ui:composition, ui:define, ui:insert – ui:include, ui:repeat 5
  • 6. Facelets – Sample Code <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html"> <h:head> <title>Enter Name &amp; Password</title> </h:head> <h:body> <h1>Enter Name &amp; Password</h1> <h:form> <h:panelGrid columns="2"> <h:outputText value="Name:"/> <h:inputText value="#{simplebean.name}" title="name" id="name" required="true"/> <h:outputText value="Password:"/> <h:inputText value="#{simplebean.password}" title="password" id="password" required="true"/> </h:panelGrid> <h:commandButton action="show" value="submit"/> </h:form> </h:body> </html> 6
  • 7. Composite Components • Enable True Abstraction – Create a true, reusable, component from an arbitrary region of a page – Built by composing other components • “Using” and “Defining” page • Full support for using attached objects in the using page – Action methods – Validators, etc 7
  • 8. Composite Components in JSF 1.x ... 8
  • 11. Composite Components – Sample Code 11
  • 12. Composite Component – Sample Code <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html"> <h:head> <title>Enter Name &amp; Password</title> </h:head> <h:body> <h1>Enter Name &amp; Password</h1> <h:form> <h:panelGrid columns="2"> <h:outputText value="Name:"/> <h:inputText value="#{simplebean.name}" title="name" id="name" required="true"/> <h:outputText value="Password:"/> <h:inputText value="#{simplebean.password}" title="password" id="password" required="true"/> </h:panelGrid> <h:commandButton action="show" value="submit"/> </h:form> </h:body> </html> 12
  • 13. Composite Components – Mapping <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:ez="http://java.sun.com/jsf/composite/ezcomp"> <h:head> <title>Enter Name &amp; Password</title> </h:head> <h:body> <h1>Enter Name &amp; Password</h1> <h:form> <ez:username-password/> <h:commandButton action="show" value="submit"/> </h:form> </h:body> </html> . . . WEB-INF index.xhtml resources/ ezcomp/ username-password.xhtml http://blogs.oracle.com/arungupta/entry/totd_147_java_server_faces 13
  • 14. Optional “faces-config.xml” • <managed-bean> → @ManagedBean or @Named – Validator, Renderer, Listener, ... • Implicit navigation rules – match a view on the disk – Conditional navigation @Named(“simplebean”) public class SimpleBean { . . . } <h:commandButton action="show" value="submit"/> 14
  • 15. Optional “web.xml” @SuppressWarnings({"UnusedDeclaration"}) @HandlesTypes({ ManagedBean.class, FacesComponent.class, FacesValidator.class, FacesConverter.class, FacesBehaviorRenderer.class, ResourceDependency.class, ResourceDependencies.class, ListenerFor.class, ListenersFor.class, UIComponent.class, Validator.class, Converter.class, Renderer.class }) public class FacesInitializer implements ServletContainerInitializer { // NOTE: Loggins should not be used with this class. private static final String FACES_SERVLET_CLASS = FacesServlet.class.getName(); 15
  • 16. Optional “web.xml” public void onStartup(Set<Class<?>> classes, ServletContext servletContext) throws ServletException { if (shouldCheckMappings(classes, servletContext)) { Map<String,? extends ServletRegistration> existing = servletContext.getServletRegistrations(); for (ServletRegistration registration : existing.values()) { if (FACES_SERVLET_CLASS.equals(registration.getClassName())) { // FacesServlet has already been defined, so we're // not going to add additional mappings; return; } } ServletRegistration reg = servletContext.addServlet("FacesServlet", "javax.faces.webapp.FacesServlet"); reg.addMapping("/faces/*", "*.jsf", "*.faces"); servletContext.setAttribute(RIConstants.FACES_INITIALIZER_MAPPINGS_ADDED, Boolean.TRUE); 16
  • 17. Project Stage • Inspired by Rails • Development – Better error reporting, debugging • Production – Better performance 17
  • 19. JSF2 – New features • Integrated Ajax – Partial tree traversal • HTTP GET support • Form-level validation • Bundling/delivering static resources with a component • System Events 19
  • 20. Integrated Ajax • Inspiration – ADF, RichFaces, IceFaces, DynamicFaces • Two entry points: – Declarative: <f:ajax> tag, uses AjaxBehavior – Programmatic ajax • resource library javax.faces • resource name jsf.js • JavaScript namespace jsf.ajax. – jsf.ajax.request function 20
  • 21. Integrated Ajax – Sample Code <h:commandButton actionListener="#{sakilabean.findActors}" value="submit"> <f:ajax execute="length" render="actorTable totalActors"/> </h:commandButton> http://blogs.oracle.com/arungupta/entry/totd_123_f_ajax_bean 21
  • 22. HTTP GET Support • GET Request handling required low-level primitives – PhasesListener • Now first-class support in JSF2 – View Parameters – Bookmarkable URLs • <h:link>/<h:button> 22
  • 23. JSF2 GET – View Parameters • Declarative way to map request parameters to EL-reachable location/model property – <f:metadata>/<f:viewParam> • Only for Facelets • Faces lifecycle for GET – Converted to proper target type – Validated before assignment – Pushed into the model • Converters/validators can be attached to <f:viewParam> 23
  • 24. View Parameters – Sample Code @Named public class Blog { int entryId; . . . } <f:metadata> page1.xhtml <f:viewParam name="id" value="#{blog.entryId}"/> </f:metadata> page1.xhtml?id=10 blog.entryId will equal “10” 24
  • 25. JSF2 GET – Bookmarkable URLs <h:link outcome="viewEntry" value="Link"> <f:param name="entry" value="#{aBean.entry}"/> </h:link> <a href="http://localhost:8080/myapp/viewEntry.xhtml?entry=entry1">Link</a> 25
  • 26. Validation • Integration with JSR 303: Bean Validation – @NotEmpty String name; – Default validator: javax.faces.Bean – automatically applied to all input fields • Use cases – Ordering constraints using Validation Groups • Basic/Cheap constraints before complex/costly ones – Partial data validation: wizard-style form • Error messages are translated to FacesMessages 26
  • 27. Validation – Sample Code <h:inputText value="#{address.zip}"> <f:validateBean validationGroups="myGroup"/> </h:inputText> <h:input id="zip" value="#{address.zip}"> <f:validateRequired /> </h:input> <h:input id="zip" value="#{address.zip}" required=”true”/> <h:input id="zip" value="#{address.zip}"> <f:validateRegex pattern="/^d{5}([-]d{4})?$/" /> </h:input> 27
  • 28. Resources • Standard way to serve image, JavaScripts, CSS, … – /resources or /META-INF/resources – No need for separate Servlet or Filter – Logically related to components, treat them that way • @ResourceDependency or @ResourceDependencies on custom components – @ResourceDependency(library=”corporate”, name=”colorAndMedia.css”) 28
  • 29. Resource EL – Sample Code • Syntax – #{resource['<resource>']} – #{resource['<library>:<resource>']} • Examples of use – <a href="#{resource['header.jpg']}"/> – <h:graphicImage value="#{resource['corp:header.jpg']}"/> 29
  • 30. System Events • Inspired by Solaris Dtrace, Linux strace, etc. • Publish/Subscribe event bus for things that happen during the JSF Lifecycle • Adds to event listening abilities – FacesEvent → FacesListener (existing) – PhaseEvent → PhaseListener (existing) – SystemEvent → SystemEventListener (new) • Mainly targeted at page/component/framework authors 30
  • 32. System Events – Sample Code <h:inputText> <f:event type="preValidate" listener="#{bean.doSomePreValidation}"/> </h:inputText> <h:inputText value="#{myBean.text}"> <f:event type="beforeRender" listener="#{myBean.beforeTextRender}"/> </h:inputText> 32
  • 33. JSF2 – Runtime Performance & Scalability • Behavior • Partial State Saving 33
  • 34. Behaviors • New type of “attached object” that enhance the component's client-side functionality – Unlike server-side Validator/Renderer – Use cases: Client-side validation, Animations and visual effects, Alerts and confirmation dialogs, Tooltips • 3 new behaviors – ClientBehavior – ClientBehaviorHolder – AjaxBehavior • f:ajax is AjaxBehavior 34
  • 35. Behaviors implements ClientBehaviorHolder UI Component addClientBehavior(eventName, behavior) ClientBehavior getScript() • Loose Coupling – Client behaviors product scripts in a component-agnostic manner – Components retrieve scripts/insert into markup in a behavior-agnostic manner 35
  • 36. Behaviors – Sample Code public class MyBehavior implements ClientBehavior { public String getScript(ClientBehaviorContext context) { return "return confirm('Really???')"; } } <h:commandLink onclick="return confirm('Really???')"/> <h:commandLink> <foo:confirm event="click"/> </h:commandLink> 36
  • 37. Partial State Saving • Inspired by Trinidad state saving • Save only the state that's changed since creation of the component tree – Initial state can be restored by re-executing the view • Per-view state size up to 4X smaller • Default for pages written with Facelets • Implemented in standard components – Default for composite components 37
  • 38. JSF 2.2 http://jcp.org/en/jsr/detail?id=344 NEW • Ease of development – cc:interface is optional – JSF lifecycle is CDI aware – Runtime configuration options change • Support implementation of Portlet Bridge 2.0 • Support for HTML5 features – Forms, Heading/Section content model, ... • New components like FileUpload and BackButton 38
  • 39. References • oracle.com/javaee • glassfish.org • oracle.com/goto/glassfish • blogs.oracle.com/theaquarium • youtube.com/GlassFishVideos • Follow @glassfish 39
  • 40. <Insert Picture Here> Java Server Faces 2.0 Arun Gupta, JavaEE & GlassFish Guy blogs.oracle.com/arungupta, @arungupta