Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 483 trang
THÔNG TIN TÀI LIỆU
Cấu trúc
Mastering JavaServer Faces
Cover
Dedication
Contents
Acknowledgments
About the Authors
Foreword
Introduction
The Genius of JSF
JSF Makes Things Easy
What Is in the Book
Layout of the Book
Summary
Part 1 Architecture of JSF
Chapter 1 JSF Patterns and Architecture
Overview
MVC and User Interfaces
MVC Pattern
Model 2 - MVC for the Web
Implementing MVC
Swing Collapsed MVC Strategy
Struts Model-2 MVC Strategy
JSF Component-Based Model-2 MVC Strategy
Composite Components
Composite Pattern
Swing Components and Containers
Struts and Tiles
JSF Component Trees
Component Events
Observer Pattern
Swing Event Listeners
Struts Application Events
JSF Events
Summary
Chapter 2 Elements of JSF
Overview
Web Development
UI Components
Standard UI Components
Identifiers
UI Component Trees
Tree Manipulation and Navigation
Facets
Generic Attributes
Data Models
Validation
Validators
Validator Registration
Standard Validators
Conversion
Converters
Converter Registration
Standard Converters
Events and Listeners
UI Events
Listeners
Phase Identifiers
Event Queuing and Broadcasting
Rendering
Delegated Rendering
Render Kits
Registering Renderers
Standard RenderKits
Summary
Chapter 3 JSF Request-Processing Life Cycle
Overview
Faces Request Generates Faces Response
Non-Faces Request Generates Faces Response
Faces Request Generates Non-Faces Response
Non-Faces Request Generates Non-Faces Response
Faces Context
Accessing Context
Component Tree
External Context
Flow Control
Localization
Message Queue
Event Queues
Standard JSF Request-Processing Life Cycle
Restore View
Apply Request Values
Process Validations
Update Model Values
Invoke Application
Render Response
Summary
Part 2 Elements of JSF
Chapter 4 JSF Configuration
Overview
Getting Started
Introduction to Sample Application
AWord about Web Applications
Web Application Structure
Web Application Deployment Descriptor
Configuring a Web Application for JSF
FacesServlet Mapping
JSF Application Configuration Files
Necessary Classes and Resources
Configuring a JSF Application
Configuration File Format
Tool Support for JSF Configurations
Building the Sample JSF Application
Summary
Chapter 5 JSP Integration in JSF
Overview
Quick JSF/JSP Integration Example
JSP Integration and the Render Response Phase
New JSF Requests
Subsequent JSF Requests
JSF ¨C JSP Integration Example
Summary
Chapter 6 UI Components
Overview
Using Components
The View
Subviews
Value Binding
Converting between Model Properties and UI Strings
Processing Submitted Form Values
Validators
Configuring Event Listeners
Working with Tables
Using Facets
A dataTable Example
Using a panelGrid
Working with Select Lists
Summary
Chapter 7 Navigation, Actions, and Listeners
Overview
Actions and Navigation
Implementing Application Actions
Specifying Navigation Rules
Working with Forms
Complex Forms
Complex Navigation
Events and Listeners
Implementing an ActionListener Method
Implementing the ActionListener Interface
Implementing a ValueChangeListener Method
Implementing the ValueChangeListener Interface
Summary
Chapter 8 Validation and Conversion
Overview
Using Converters
Setting the converter Attribute in Input Tags
Standard Converters
Using Custom Converters for Validation
Displaying Error Messages
Registering the Converter
Using Converters to Validate Custom Value Types
Converter Registration by Type
Using Validators
Adding Validator Bindings in JSP
Validator Methods
Displaying Error Messages
Creating Custom Validators
Adding Attributes to Custom Validators
Creating a Custom Validator Tag
Conversion and Validation Processing
Summary
Part 3 Applying JSF
Chapter 9 Building JSF Applications
Overview
Architectural Overview
JSF in the Architecture
Connecting View, Controller, and Model Objects
iBank Bill Payment Application
Login Screen
Account Summary
Review Historical Payments
Logging into iBank
Configuration
The Two-Tiered Model for Login
Three-Tiered Model for Login
Welcome to iBank
Making an iBank Payment
Reviewing iBank Payments
Summary
Chapter 10 Custom JSF Components
Overview
What Is a Custom Component?
Aggregate Component
New HTML Generator
New Client Type
Motivation for Building a Custom Component
Aspects of Custom Components
Restore View
Apply Request Values
Process Validations
Update Model Values
Invoke Application
Render Response
Custom Component Example
UIScroller Component Code
UIScroller Renderer Code
UIScroller JSP Tag Code
Summary
Chapter 11 Converting a Struts Application to JSF
Overview
Defining the Example Problem: The SimpleBlogger
Use Cases
Screen Design
State Diagram
Domain Classes
The Struts Version of the SimpleBlogger
Domain Classes
Struts Configuration Files
JSPPages
Form Classes
Action Classes
The JSF Version of the SimpleBlogger
Set Up the Environment
Copy the Business Model Objects
Convert the Struts ActionForm Classes to Managed Beans
Convert the JSP Pages
Build the Navigation Model
Add the Action Handlers
Summary
Appendix What's on the Web Site
System Requirements
For Linux
For Macintosh
References
Index
Team DDU
Nội dung
[...]... keep handy at your elbow as you develop JavaServer Faces applications Ed Burns, JSF Implementation Lead and Co-Specification Lead Introduction JavaServer Faces (JSF) is an exciting new technology that will change the way we build user interfaces for Java 2 Enterprise Edition applications With the introduction of JSF, we can finally create user interfaces simply with a set of reusable components And... directly to the development of JavaServer Faces, also the team of dedicated engineers that brought the first reference implementation to market, and the early adopters in our initial access and beta program who discovered the hard bugs and had the patience to wait for us to get it right the first time xv xvi Foreword Now, to the matter of Mastering JavaServer Faces This book is all about getting you... and managing the use case process Foreword JavaServer Faces is a holistic solution to several longstanding problems facing software developers and the customers who consume the software For the end user, JavaServer Faces holds the promise of an easier, more intuitive usage experience for Web-based applications For software developers, JavaServer Faces provides a standard, object-oriented, easy-to-use... Mastering JavaServer Faces This book is all about getting you up to speed and productive with JavaServer Faces quickly, and providing enough depth to keep you on track once you are The authors have done a great job of taking the complexity inherent in providing a complete API for Web application user interfaces and pulling out the simple concepts on which this API was built If you’ve read any of the author’s... programming interface (API) that takes much of the pain out of bringing a great user experience to the world of Web applications JavaServer Faces gives users the power, flexibility, and performance that have previously been addressed only in a piecemeal fashion JavaServer Faces was developed by a community of Web application experts assembled by the Java Community Process These experts are the people behind... be surprised to see how heavily JSF is influenced by both frameworks MVC and User Interfaces MVC was first popularized with Smalltalk (Goldberg & Robson 1983) and is now used in many modern user interface frameworks One of the primary benefits of MVC is that it provides reusable components for interactive user interfaces Swing does this admirably for rich Java clients, while Struts does so to a lesser... flow and be executed The component-based model also allows developers to focus on providing great features instead of trying to focus on two or three different models for building Web-based user interfaces It also allows the promise of reusable offthe-shelf components in the future In the same way that you can purchase a Swing-based UI component that plots graphs of data, you will be able to buy off-the-shelf... application is made of four tiers: Web, JSP/Servlet, EJB, and database JSF fits into the JSP/Servlet tier and provides a component-based approach to building applications JSF provides a way to build user interfaces and delegate the business processing to the next layer (that is, the EJB layer) We will see a lot more about this in Chapter 1, “JSF Patterns and Architecture.” Application logic can take the form... into building real-world applications The following chapters are in this section: Chapter 4: JSF Configuration This chapter deals with what you have to do to configure your JSF application Details of the faces- config.xml file and what to add to your Web.xml file as well as how to get the TagLibs setup will be covered Chapter 5: JSP Integration in JSF This chapter covers the details of how JSF integrates... with JSF as well as be able to create your own Introduction xxiii Part 3, “Applying JSF,” covers using JSF in the real world to build applications Specifically covered here are integrating JSF user interfaces with the business tier (be it EJB or POJO), building custom components to render your own user interface components, and converting your existing Struts applications to JSF The following chapters . 81 Faces Request Generates Faces Response 83 Non -Faces Request Generates Faces Response 83 Faces Request Generates Non -Faces Response 84 Non -Faces Request Generates Non -Faces Response 85 Faces. Mattingly Mastering JavaServer ™ Faces 01_462071 ffirs.qxd 5/18/04 8:34 AM Page i 01_462071 ffirs.qxd 5/18/04 8:34 AM Page iv Bill Dudney Jonathan Lehr Bill Willis LeRoy Mattingly Mastering. 5/18/04 8:36 AM Page xv Now, to the matter of Mastering JavaServer Faces. This book is all about get- ting you up to speed and productive with JavaServer Faces quickly, and pro- viding enough depth