Facelets - PowerPoint PPT Presentation

1 / 19
About This Presentation
Title:

Facelets

Description:

Composition and Component. View Handler for JSF. Throws out JSP. Demo ... Composition ... ui:composition template='/SimpleTemplate.xhtml' ui:define name ... – PowerPoint PPT presentation

Number of Views:95
Avg rating:3.0/5.0
Slides: 20
Provided by: thomasav
Category:

less

Transcript and Presenter's Notes

Title: Facelets


1
Facelets
  • letting go of JavaServer Pages

2
Outline
  • Evolution of Web Frameworks
  • Facelets
  • Overview
  • Syntax
  • Demo
  • AJAX Support
  • Scalability/Performance
  • Support
  • Wrap-up
  • Recommended Reading

3
Evolution of Web Frameworks
  • Servlets - 1997
  • Procedural JSP - 1999
  • Composition Frameworks
  • Tapestry
  • 2000
  • Action Frameworks
  • Struts
  • 2001
  • Component Frameworks
  • JavaServer Faces
  • 2004

4
Facelets Overview
  • Composition and Component
  • View Handler for JSF
  • Throws out JSP

5
Demo
  • Hello World and Code

6
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

7
Facelets web.xml
  • ltweb-appgt
  • lt!-- Use Documents Saved as .xhtml --gt
  • ltcontext-paramgt
  • ltparam-namegtjavax.faces.DEFAULT_SUFFIXlt/param-na
    megt
  • ltparam-valuegt.xhtmllt/param-valuegt
  • lt/context-paramgt
  • lt!-- Faces Servlet --gt
  • ltservletgt
  • ltservlet-namegtFaces Servletlt/servlet-namegt
  • ltservlet-classgtjavax.faces.webapp.FacesServletlt/
    servlet-classgt
  • ltload-on-startupgt1lt/load-on-startupgt
  • lt/servletgt
  • lt!-- Faces Servlet Mapping --gt
  • ltservlet-mappinggt
  • ltservlet-namegtFaces Servletlt/servlet-namegt
  • lturl-patterngt.jsflt/url-patterngt
  • lt/servlet-mappinggt

8
Facelets faces-config.xml
  • ltfaces-configgt
  • ltapplicationgt
  • ltview-handlergt
  • com.sun.facelets.FaceletViewHandler
    lt/view-handlergt
  • lt/applicationgt
  • lt/faces-configgt

9
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()

10
Facelets xhtml Template
  • lt!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN" "http//www.w3.org/TR/xhtml1/DTD
    /xhtml1-transitional.dtd"gt
  • lthtml xmlns"http//www.w3.org/1999/xhtml"
    xmlnsui"http//java.sun.com/jsf/facelets"gt
  • ltheadgt
  • lttitlegtFacelets Demolt/titlegt
  • ltlink rel"stylesheet" href"style.css"
    type"text/css" /gt
  • lt/headgt
  • ltbodygt
  • ltimg src"images/ldslogo.gif" border"0" /gt
  • ltdivgt
  • ltuiinsert name"login"gt
  • Login goes here
  • lt/uiinsertgt
  • lt/divgt
  • lt/bodygt
  • lt/htmlgt

11
Facelets xhtml Composition
  • lt!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN" "http//www.w3.org/TR/xhtml1/DTD
    /xhtml1-transitional.dtd"gt
  • lthtml xmlns"http//www.w3.org/1999/xhtml"
  • xmlnsui"http//java.sun.com/jsf/facelets"
  • xmlnsh"http//java.sun.com/jsf/html"
  • xmlnsf"http//java.sun.com/jsf/core"gt
  • ltbodygt
  • ltuicomposition template"/SimpleTemplate.xhtml"gt
  • ltuidefine name"title"gt
  • lt/uidefinegt
  • ltuidefine name"login"gt
  • ltfloadBundle basename"com.vallettas.facelets.dem
    o.login" var"msg" /gt
  • lthform id"login"gt
  • lthpanelGrid columns"2" align"center"gt
  • lthoutputText value"msg.username" /gt
  • lthinputText value"LoginBean.username" /gt
  • lthoutputText value"msg.password" /gt
  • lthinputSecret value"LoginBean.password" /gt

12
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

13
Evolving JavaServer Faces Technology
  • Ajax Done Right Slide 21 - 35

Edward Burns Jacob Hookom Adam Winer
14
Scalability/Performance
  • Better than JavaServer Pages using JSP
  • 5 - 33 faster

15
Support
  • Tool Support
  • Exadel Studio
  • XML/XHTML Support
  • Eclipse
  • IntelliJ IDEA
  • NetBeans
  • JBuilder
  • JDeveloper

16
Support
  • Industry Support
  • ?

17
Support
  • Technical Support
  • https//facelets.dev.java.net
  • Google returns 133,000 results its a start
  • 1.0 release - Nov 14, 2005

18
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

19
Recommended Reading
  • Articles
  • Improving JSF by Dumping JSP - Hans
    Bergstenhttp//www.onjava.com/pub/a/onjava/2004/0
    6/09/jsf.html
  • Facelets fits JSF like a glove Richard
    Hightowerhttp//www-128.ibm.com/developerworks/ja
    va/library/j-facelets/
  • Inside Facelets Part 1 An Introduction Jacob
    Hookomhttp//www.jsfcentral.com/articles/facelets
    _1.html
  • Facelets Developer Documentation Jacob
    Hookomhttps//facelets.dev.java.net/nonav/docs/de
    v/docbook.html
Write a Comment
User Comments (0)
About PowerShow.com