JavaServer Faces 2.0, The Complete Reference

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

The Definitive Guide to JavaServer Faces 2.0 Fully revised and updated for all of the changes in JavaServer Faces (JSF) 2.0, this comprehensive volume covers every aspect of the official standard Web development architecture for JavaEE. Inside this authoritative resource, the co-spec lead for JSF at Sun Microsystems shows you how to create dynamic, cross-browser Web applications that deliver a world-class user experience while preserving a high level of code quality and maintainability. JavaServer Faces 2.0: The Complete Reference features an integrated sample application to use as a model for your own JSF applications, with code available online. The book explains all JSF features, including the request processing lifecycle, managed beans, page navigation, component development, Ajax, validation, internationalization, and security. Expert Group Insights throughout the book offer insider information on the design of JSF. Set up a development environment and build a JSF application Understand the JSF request processing lifecycle Use the Facelets View Declaration Language, managed beans, and the JSF expression language (EL) Define page flow with the JSF Navigation Model, including the new "Implicit Navigation" feature Work with the user interface component model and the JSF event model, including support for bookmarkable pages and the POST, REDIRECT, GET pattern Use the new JSR-303 Bean Validation standard for model data validation Build Ajax-enabled custom UI components Extend JSF with custom non-UI components Manage security, accessibility, internationalization, and localization Learn how to work with JSF and Portlets from the JSF Team Leader at Liferay, the leading Java Portal vendor Ed Burns is a senior staff engineer at Sun Microsystems and is the co-specification lead for JavaServer Faces. He is the co-author of JavaServer Faces: The Complete Reference and author of Secrets of the Rock Star Programmers. Chris Schalk is a developer advocate and works to promote Google's APIs and technologies. He is currently engaging the international Web development community with the new Google App Engine and OpenSocial APIs. Neil Griffin is committer and JSF Team Lead for Liferay Portal and the co-founder of The PortletFaces Project. Ready-to-use code at www.mhprofessonal.com/computingdownload

Author(s): Ed Burns, Chris Schalk
Edition: 1
Year: 2009

Language: English
Pages: 752

Contents......Page 10
Acknowledgments......Page 24
Introduction......Page 26
Part I: The JavaServer Faces Framework......Page 32
What Is JavaServer Faces?......Page 34
The History of JavaServer Faces......Page 35
The JavaServer Faces Design Goals......Page 38
JSF Application Architecture......Page 40
Application Overview......Page 46
Building and Running the Application......Page 61
Reviewing the Key Portions of the Application......Page 63
A High-Level Overview of the JSF Request Processing Lifecycle......Page 66
Observing the Request Processing Lifecycle in Action......Page 77
Advanced Topics Related to the Request Processing Lifecycle......Page 81
Lifecycle Concepts to Remember......Page 84
4 The Facelets View Declaration Language......Page 86
The Power of Templating in Faces......Page 87
Similarities and Differences Between JSP and Facelets......Page 88
Templating with Facelets......Page 89
Guide to Facelets Templating Tags......Page 93
Guide to Nontemplating Facelets Tags......Page 96
5 Managed Beans and the JSF Expression Language......Page 98
What Are Managed Beans?......Page 99
Controlling Managed Bean Life Spans......Page 112
The JSF Expression Language......Page 115
Web Application Development Details on Managed Beans......Page 128
Using Implicit Navigation......Page 134
Overview of the JSF Navigation System......Page 137
Building Navigation Rules......Page 140
More Sophisticated Navigation Examples......Page 147
What Are UI Components?......Page 166
Introducing the JSF UI Component Architecture......Page 169
UI Components and Facelets......Page 178
8 Converting and Validating Data......Page 186
Some Validation and Conversion Examples......Page 187
Conversion and Validation Under the Covers......Page 189
The Faces Converter System......Page 193
The Faces Validation System......Page 206
How to Associate a Validator with a UIComponent Instance......Page 210
Using Bean Validation from JSF......Page 216
Tie It All Together: Messages in a View......Page 221
A High-Level Overview of the JSF Event Model......Page 230
How JSF Events Work......Page 234
Writing Custom Action and Value Change Listeners......Page 243
More Faces Event Examples......Page 246
Working with Phase Events and Listeners......Page 252
Working with SystemEvents and Listeners......Page 255
General Rules for Creating Custom Application Events and Listeners......Page 260
Part II: Extending JavaServer Faces......Page 264
10 Applying JSF: Introducing the Virtual Trainer Application......Page 266
A Quick Tour of the Virtual Trainer Application......Page 267
The Virtual Trainer Application Architecture......Page 274
Facelet Pages......Page 275
Backing Beans......Page 277
Persistence and Transaction Architecture......Page 279
Navigation Concerns......Page 283
Creating a Simple Authentication System......Page 286
Revisiting JSFReg: Building the Registration System......Page 290
Building the Core Pages of the Virtual Trainer Application......Page 294
The UserRegistry and EventRegistry......Page 303
Accessing and Initializing the EventRegistry Instance......Page 308
Reading and Writing Event Instances......Page 309
JPA and the Entity Classes in Virtual Trainer......Page 311
Internationalizing the Virtual Trainer Application......Page 315
Final Comments on Virtual Trainer......Page 325
Deciding When to Build a Custom UI Component......Page 326
What Are UI Components?......Page 327
A Simple JSF UI Component......Page 328
The Code Behind the Markup of This Simple JSF UI Component......Page 330
Adding Behavior to a Composite Component......Page 332
The Parts of a UI Component......Page 337
A Noncomposite JSF Custom UIComponent......Page 338
State Management with Custom Components......Page 347
Extracting Rendering Code into a Renderer......Page 349
Advanced Composite Component Development......Page 361
Packaging JSF Components into a Self-Contained Jar......Page 366
Packaging a Composite Component into a Jar......Page 367
Packaging a Noncomposite Component into a Jar......Page 368
Ajax Overview......Page 370
A Simple Ajax Example from JSFReg......Page 372
The Tag and Its Attributes......Page 380
The Standard JavaScript Resource......Page 387
Non-UI Custom Components and Decoration in JSF......Page 390
PhaseListener......Page 394
Converter and Validator......Page 395
ViewHandler......Page 396
VariableResolver and PropertyResolver......Page 397
ELResolver (JSF 1.2)......Page 400
NavigationHandler......Page 409
ActionListener......Page 410
StateManager......Page 411
RenderKit......Page 413
Factories in JSF......Page 414
Additional Non-UIComponent Topics......Page 427
Aspects and Implementation of Web Application Security......Page 430
Container-Managed Security......Page 431
Application-Managed Security with JavaServer Faces......Page 442
Part III: JavaServer Faces Tools and Libraries......Page 452
15 Configuring JavaServer Faces Applications......Page 454
Understanding How Configuration Files Are Processed......Page 456
Ordering of faces-config.xml Files......Page 457
The Faces Configuration Elements......Page 458
Extension Elements......Page 552
A Brief Review of JSF, Facelets, and JSP Tag Nomenclature......Page 556
Acquiring and Installing the Standard Libraries......Page 557
The Standard HTML Library......Page 590
The Standard Facelets Templating Library (2.0)......Page 662
The Standard Facelets Composite Component Library (2.0)......Page 674
Portlet Lifecycle......Page 690
Portlet Modes......Page 691
Portlet Preferences......Page 692
Inter-Portlet Communication......Page 693
JSF Portlet Bridges......Page 694
JSF Portlet View Handlers......Page 698
JSF and Portlet Preferences......Page 699
JSF and Inter-Portlet Communication......Page 701
ICEfaces Ajax with Partial Submit......Page 703
The ice:portlet Tag......Page 704
ICEfaces 1.x D2DFaceletViewHandler......Page 705
ICEfaces 1.x Extended Request Scope......Page 706
ICEfaces Ajax Push and Inter-Portlet Communication......Page 707
ICEfaces Themes and Portal Themes......Page 710
ICEfaces Themes and Liferay Themes......Page 711
ICEfaces Ajax Bridge and Liferay Portal......Page 712
PortletFaces......Page 713
Downloading PortletFaces......Page 714
PortletFacesContext......Page 715
PortletFaces Tags......Page 716
PortletFaces and Portlet Preferences......Page 717
PortletFaces Expression Language Additions......Page 718
PortletFaces and Localization......Page 720
Improved Integration Between Liferay and ICEfaces 1.x......Page 721
A......Page 724
C......Page 726
D......Page 729
E......Page 730
F......Page 731
G......Page 733
H......Page 734
I......Page 735
J......Page 736
L......Page 737
M......Page 739
N......Page 740
P......Page 741
R......Page 743
S......Page 745
U......Page 748
V......Page 750
W......Page 752
Z......Page 753