Introduction to Java Server Faces JSF - PowerPoint PPT Presentation

1 / 27
About This Presentation
Title:

Introduction to Java Server Faces JSF

Description:

Required Jars: WEB-INF/lib/jsf-api.jar. WEB-INF/lib/jsf-ri.jar. WEB-INF/lib/jstl.jar ... WEB-INF/lib/commons-logging.jar. JSF Application Directory Structure ... – PowerPoint PPT presentation

Number of Views:852
Avg rating:3.0/5.0
Slides: 28
Provided by: conest
Category:

less

Transcript and Presenter's Notes

Title: Introduction to Java Server Faces JSF


1
Introduction to Java Server Faces (JSF)
  • Presented By

Balazs Igli James Edmond Scott McLellan
2
Agenda
  • JSF topics to cover
  • What is JSF?
  • Architecture Overview
  • UI Component Model
  • Development Steps

3
JavaServer Faces (JSF) Framework Is
  • A server side user interface component framework
    for Java technology-based web applications

4
What Is JSF
  • A specification and reference implementation
    for a web application development framework
  • Components
  • Events
  • Validators converters
  • Navigation
  • Back-end-data integration

5
Agenda
  • JSF topics to cover
  • What is JSF?
  • Architecture Overview
  • UI Component Model
  • Development Steps

6
Request Processing Lifecycle Phases
7
Agenda
  • JSF topics to cover
  • What is JSF?
  • Architecture Overview
  • UI Component Model
  • Development Steps

8
User Interface Component Model
  • UI components
  • Event handling model
  • Conversion and Validation model
  • Rendering model
  • Page navigation support

9
UI Components
  • UIComponent/UIComponentBase
  • Base class for all user interface components
  • Standard UIComponent Subclasses
  • UICommand, UIForm, UIOutput
  • UIGraphic, UIInput, UIPanel, UIParameter
  • UISelectBoolean, UISelectMany, UISelectOne
  • Example

10
Validators and Converters
  • Validators - Perform correctness checks on
    UIInput values
  • Register one or more per component
  • Enqueue one or more messages on errors
  • Standard implementations for common cases
  • Converters - Plug-in for conversions
  • Output Object to String
  • Input String to Object
  • Standard implementations for common cases

11
Converters and Validators
  • Examples

12
Rendering Model
  • Renderers - Adapt components to a specific
    markup language
  • Decoding
  • Encoding
  • RenderKits Library of Renderers
  • Map component classes to component tags
  • Is a custom tag library
  • Basic HTML RenderKit

13
Events and Listeners
  • Follows JavaBeans Specification design and
    naming patterns
  • Standard events and listeners
  • ActionEvent - UICommand component activated by
    the user
  • ValueChangedEvent - UIInput component whose value
    was just changed

14
Navigation Model
  • Application developer responsibility
  • Defined in Application configuration file
    (Facesconfig.xml)
  • Navigation rules
  • Determine which page to go.
  • Navigation case

15
Navigation Model Example
16
Agenda
  • JSF topics to cover
  • What is JSF?
  • Architecture Overview
  • UI Component Model
  • Development Steps

17
Steps in Development Process
  • Develop model objects which hold the data
  • Add model objects (managed bean) declarations to
    Application Configuration File faces-config.xml
  • Create Pages using UI component and core tags
  • Define Page Navigation in faces-config.xml
  • Configure web.xml

18
Step 1 Develop model Objects(Managed Bean)
  • A regular JavaBeans with read/write properties
  • May contain application methods and event
    handlers
  • Use to hold data from a UI (page)
  • Creation and lifetime is managed by JSF runtime
  • Application, session, request
  • JSF keeps the bean's data in sync with the UI

19
Step 2. Managed Bean Declaration(Faces-config.xml
)

20
Step 3 Create JSF Pages
  • Must include JSF tag library
  • HTML and core tags
  • All JSF tags must enclosed between a set of view
    tag
  • Use JSF form and form component tags
  • lthinput_textgt not ltinput typetextgt
  • lthcommand_buttongt not ltinput typesubmitgt
  • May include validators and event listeners on any
    form components

21
Binding UI to Managed Bean

22
Step 4 Define Page Navigation Rules(Faces-config
.xml)

23
Step 5 Configure (web.xml)

24
JSF Application Directory Structure
  • WEB-INF/web.xml
  • WEB-INF/faces-config.xml
  • WEB-INF/classes/LoginFormBean.class
  • login.jsp
  • Required Jars
  • WEB-INF/lib/jsf-api.jar
  • WEB-INF/lib/jsf-ri.jar
  • WEB-INF/lib/jstl.jar
  • WEB-INF/lib/jsf-el.jar
  • WEB-INF/lib/standard.jar
  • WEB-INF/lib/commons-beanutils.jar
  • WEB-INF/lib/commons-digester.jar
  • WEB-INF/lib/commons-collections.jar
  • WEB-INF/lib/commons-logging.jar

25
Advantages and Disadvantages
  • Advantages
  • JSF is a specification from Sun and will be
    included in future versions of the J2EE
    specification.
  • All major vendors are pledging strong support for
    JSF.
  • JSF has a well-defined request lifecycle allowing
    for plugability at different levels.
  • Because JSF has a rich component model, it favors
    a RAD style of development.
  • Disadvantages
  • JSF is still quite new and evolving.
  • Is not as easy to develop with compared to other
    alternatives.

26
Conclusion
  • JSF is a server side User Interface framework
    made up of its own components designed for Java
    and Web Based technologies
  • All 6 phases of the life cycle is required and
    allows for maximum customization and data
    manipulation
  • The User Interface components allow for events,
    validations, data type conversions, rendering the
    components in a browser and navigation rules
  • We can define managed beans in the
    faces-config.xml and then access public
    properties ad methods from the bean and use them
    on the JSF pages

27
The End
  • Any Questions?
Write a Comment
User Comments (0)
About PowerShow.com