Facelets
Upcoming SlideShare
Loading in...5
×
 

Facelets

on

  • 2,158 views

 

Statistics

Views

Total Views
2,158
Views on SlideShare
2,155
Embed Views
3

Actions

Likes
1
Downloads
95
Comments
0

1 Embed 3

http://www.slideshare.net 3

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Facelets Facelets Presentation Transcript

  • Facelets letting go of JavaServer™ Pages
  • Outline
    • Evolution of Web Frameworks
    • Facelets
      • Overview
      • Syntax
      • Demo
      • AJAX Support
      • Scalability/Performance
      • Support
    • Wrap-up
      • Recommended Reading
  • Evolution of Web Frameworks
    • Servlets - 1997
    • Procedural JSP - 1999
    • Composition Frameworks
      • Tapestry
      • 2000
    • Action Frameworks
      • Struts
      • 2001
    • Component Frameworks
      • JavaServer™ Faces
      • 2004
  • Facelets: Overview
    • Composition and Component
    • View Handler for JSF
    • Throws out JSP
  • Demo Hello World and Code
  • Facelets: Dependencies
    • [application root]
      • WEB-INF
        • Classes
        • lib
          • jsf-facelets.jar
          • el-api.jar
          • el-ri.jar
          • jsf-api.jar
          • jsf-impl.jar
          • commons-digester.jar
          • commons-logging.jar
          • commons-collections.jar
          • commons-beanutils.jar
        • web.xml
        • faces-config.xml
      • [xhtml documents]
  • Facelets: web.xml
    • <web-app>
    • <!-- Use Documents Saved as *.xhtml -->
    • <context-param>
    • <param-name> javax.faces.DEFAULT_SUFFIX </param-name>
    • <param-value >.xhtml </param-value>
    • </context-param>
    • <!-- Faces Servlet -->
    • <servlet>
    • <servlet-name>Faces Servlet</servlet-name>
    • <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    • <load-on-startup>1</load-on-startup>
    • </servlet>
    • <!-- Faces Servlet Mapping -->
    • <servlet-mapping>
    • <servlet-name>Faces Servlet</servlet-name>
    • <url-pattern>*.jsf</url-pattern>
    • </servlet-mapping>
    • </web-app>
  • Facelets: faces-config.xml
    • <faces-config>
    • <application>
    • <view-handler>
    • com.sun.facelets.FaceletViewHandler </view-handler>
    • </application>
    • </faces-config>
  • Facelets: Managed Bean
    • package com.vallettas.facelets.demo;
    • public class Login {
    • private String username;
    • private String password;
    • public String getUsername() {
    • return username;
    • }
    • public void setUsername(String username) {
    • this.username = username;
    • }
    • public String getPassword() {
    • return password;
    • }
    • public void setPassword(String password) {
    • this.password = password;
    • }
    • public String login() {
    • return &quot;success&quot;;
    • }
    • }
  • Facelets: xhtml Template
    • <!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;>
    • <html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xmlns:ui=&quot;http://java.sun.com/jsf/facelets&quot;>
    • <head>
    • <title>Facelets Demo</title>
    • <link rel=&quot;stylesheet&quot; href=&quot;style.css&quot; type=&quot;text/css&quot; />
    • </head>
    • <body>
    • <img src=&quot;images/ldslogo.gif&quot; border=&quot;0&quot; />
    • <div>
    • <ui:insert name=&quot;login&quot;>
    • Login goes here
    • </ui:insert>
    • </div>
    • </body>
    • </html>
  • Facelets: xhtml Composition
    • <!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;>
    • <html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;
      • xmlns:ui=&quot;http://java.sun.com/jsf/facelets&quot;
      • xmlns:h=&quot;http://java.sun.com/jsf/html&quot;
      • xmlns:f=&quot;http://java.sun.com/jsf/core&quot;>
    • <body>
      • <ui:composition template=&quot;/SimpleTemplate.xhtml&quot;>
        • <ui:define name=&quot;title&quot;>
        • </ui:define>
        • <ui:define name=&quot;login&quot;>
          • <f:loadBundle basename=&quot;com.vallettas.facelets.demo.login&quot; var=&quot;msg&quot; />
          • <h:form id=&quot;login&quot;>
          • <h:panelGrid columns=&quot;2&quot; align=&quot;center&quot;>
            • <h:outputText value=&quot;#{msg.username}&quot; />
            • <h:inputText value=&quot;#{LoginBean.username}&quot; />
            • <h:outputText value=&quot;#{msg.password}&quot; />
            • <h:inputSecret value=&quot;#{LoginBean.password}&quot; />
            • <h:commandButton action=&quot;#{LoginBean.login}&quot; value=&quot;Login&quot; />
          • </h:panelGrid>
          • </h:form>
        • </ui:define>
      • </ui:composition>
      • </body>
    • </html>
  • Ajax Support
    • Swim lane approach to Ajax
      • Every widget for himself
    • JSF Mediation approach
      • A widget can affect multiple parts
      • Logic stays in Java
      • … but what about the performance implications of reconstituting the JSF tree after every…
  • Evolving JavaServer™ Faces Technology: Ajax Done Right – Slide 21 - 35 Edward Burns Jacob Hookom Adam Winer
  • Scalability/Performance
    • Better than JavaServer™ Pages using JSP
      • 5% - 33% faster
  • Support
    • Tool Support
      • Exadel Studio
      • XML/XHTML Support
        • Eclipse
        • IntelliJ IDEA
        • NetBeans
        • JBuilder
        • JDeveloper
  • Support
    • Industry Support
    • ?
  • Support
    • Technical Support
    • https://facelets.dev.java.net
    • Google returns 133,000 results – it’s a start
      • 1.0 release - Nov 14, 2005
  • Developer Velocity
    • Better than JavaServer™ Pages using JSP
      • 30% - 500% faster
        • Little to no tool support
      • Source for statistics
        • Dan Harmer 30%-40%
        • Mike Youngstrom 5x
        • Matt Wheeler 2x
        • Stephan Heilner 2x
        • Monal Daxini 2x
        • Me 30%-50%
  • Recommended Reading
    • Articles
      • Improving JSF by Dumping JSP - Hans Bergsten http://www.onjava.com/pub/a/onjava/2004/06/09/jsf.html
      • Facelets fits JSF like a glove – Richard Hightower http://www-128.ibm.com/developerworks/java/library/j-facelets/
      • Inside Facelets Part 1: An Introduction – Jacob Hookom http://www.jsfcentral.com/articles/facelets_1.html
      • Facelets Developer Documentation – Jacob Hookom https://facelets.dev.java.net/nonav/docs/dev/docbook.html