Introduction To JSF
Overview
Advantages Of Web Applications
Java Web Applications
Problems with Web Applications
Solution: Web Frameworks
JavaServer Faces (JSF)
JSF Web Application
Example: Login Screen
Authenticator Class
Managed Bean: LoginController
View: JSF JSP Code
View: HTML Form Generation
View: Value and Method Bindings
View Result: accessGranted.jsp
Lifecycle for Successful Login
Lifecycle for Failed Login
JSF Config: faces-config.xml
Servlet Config: web.xml
JSF Web Application Structure
Review
Lab: Login Page
JSF Fundamentals
Overview
JSF Implementations
JSF Setup
Example Application
JSF Application Design
Example Application Page Flow
UI Layer vs. Business Model
Simple Case: JSF Model/Controller
Complex Case: Separate Model
Sample Data Access Methods
Managed Beans and the Model
Example: ProductController
JSF Expression Language
Expression Language Evaluation
Value and Method Binding
Expression Language Syntax
EL Implicit Objects
JSF Navigation Configuration
Forward vs. Redirect
Managed Bean Configuration
Managed Bean Initialization
Example: Existing & New Products
Review
Lab: Edit Product
JSF UI Components
Overview
JSF UI Components
JSF Tag Libraries
UI Component Tree
UI Component Families
Component Attributes
Using the "id" Attribute
Using the "value" Attribute
Using the "rendered" Attribute
Pass-through Attributes
The View Root
Basic Output Components
Using Output Links
Containers and Subcomponents
Form Component
Basic Input Components
Selection Components
Specifying Selection Options
Example: Parent Category Options
Review
Lab: Edit Category
JSF Advanced Components
Overview
Subviews
Limitations of Subviews
Solutions for Subviews
Linking to Subview Controllers
Messages Components
Global vs. Local Messages
Container Components
Using <h:panelGroup>
Using <h:panelGrid>
Using <f:verbatim>
Generating Data Tables
Example Data Table
Data Table Facets
Listeners, Validators, Converters
Review
Lab: Show Category and Subviews
JSF I18N and Validations
Overview
JSF and I18N
JSF I18N Configuration
User-Locale Specification
Customizing Standard Messages
Handling Application Messages
Action Method Error Messages
Example: Message Manager
Using Our Message Manager
Configuring Our Message Manager
Service Manager vs. Backing Bean
Converters
Converting Dates and Numbers
Validation Properties
Custom Validation Methods
Standard Validators
Validator and Converter Messages
Review
Lab: Validations, Errors, Messages
JSF Events and Lifecycle
Overview
JSF Events Basics
Event Listeners
Event Listener Logic
Problems with Value Changes
JSF LifeCycle
Special Lifecycle Cases
View Storage
Phase 1: Restore View
Phase 2: Apply Requests Values
Phase 3: Process Validations
Phase 4: Update Model Values
Phase 5: Invoke Application
Phase 6: Render Response
Lifecycle Customization
Example: View/Model Mismatches
The Mismatch Problems
Solution: Model Adapter
Example Adapter: OrderItem
OrderController Logic
Deletion Logic in Action Method
Edit Order View Logic
Review
Lab: Edit Order
JSF Integration
Overview
System Services
Example: Data Access Objects
Example DAO Code
Service Managers for Integration
Using Service Managers
Service Manager vs. Backing Bean
Example: Testing with Mock DAO
Access to the Servlet API
Minimize Servlet-Specific Code
Managing Session Data
JSP-to-JSF Integration
JSF-to-JSP Integration
JSP Integration Problems
Application Initialization Logic
Integration with Other Frameworks
CSS Integration
Style Classes for JSF Components
JavaScript Integration
JavaScript Validation Logic
How Many Layers to Use
Review
Lab: JSF Integration
The JSF Environment
Overview
Caveat for Customization
JSF Package Structure
Core JSF Processing
The Faces Servlet
The Faces Context
The External Context
The Application Object
Component Interfaces
The JSF Life Cycle
JSF Events
Registering Phase Listeners
Phase Id Constants
The Render Kit
Components and Renderers
Rendering Control
Review
Lab: The JSF Environment
JSF Custom Components
Overview
Caveat for Customization
Steps for Custom UI Components
Example Component
Example Custom Tag
Example Configuration
Custom Components in JSP
Class, Type and Family
Component Inheritance Hierarchy
Component Superclasses
Component State
Saving/Restoring State
Output Encoding
Input Decoding
Value Holders
Editable Value Holders
Events and Action Sources
Naming Containers
Custom JSP Tags
Review
Lab: JSF Custom Components
JSF Custom Validators and Converters
Overview
Custom Validations
Conversion and Validation Errors
Custom Validators
Example Validator
Example Validator Tag
Example Configuration
Custom Validator in JSP
One-Shot Validation Methods
Converters: By Class or ID
Custom Converters
Example Converter
Example Configuration
Using Simple Converters
Handling Null Values
State and Validators/Converters
Packaging Custom Components
Review
Lab: Validators and Converters