JavaServer Faces (JSF) is quickly emerging as the leading solution for rapid user interface development in Java-based server-side applications. Now, Core JavaServer™ Faces–the #1 guide to JSF–has been thoroughly updated in this second edition, covering the latest feature enhancements, the powerful Ajax development techniques, and open source innovations that make JSF even more valuable.
Authors David Geary and Cay Horstmann delve into all facets of JSF 1.2 development, offering systematic best practices for building robust applications, minimizing handcoding, and maximizing productivity. Drawing on unsurpassed insider knowledge of the Java platform, they present solutions, hints, tips, and “how-tos” for writing superior JSF 1.2 production code, even if you’re new to JSF, JavaServer Pages™, or servlets.
The second edition’s extensive new coverage includes: JSF 1.2’s improved alignment with the broader Java EE 5 platform; enhancements to the JSF APIs; controlling Web flow with Shale; and using Facelets to replace JSP with XHTML markup. The authors also introduce Ajax development with JSF–from real-time validation and Direct Web Remoting to wrapping Ajax in JSF components and using the popular Ajax4jsf framework.
This book will help you
- Automate low-level details and eliminate unnecessary complexity in server-side development
- Discover JSF best practices, ranging from effective UI design and style sheets to internationalization
- Use JSF with Tiles to build consistent, reusable user interfaces
- Leverage external services such as databases, LDAP directories, authentication/authorization, and Web services
- Use JBoss Seam to greatly simplify development of database-backed applications
- Implement custom components, converters, and validators
- Master the JSF 1.2 tag libararies, and extend JSF with additional tag libraries
Preface
Acknowledgments
Chapter 1: Getting Started
Chapter 2: Managed Beans
Chapter 3: Navigation
Chapter 4: Standard JSF Tags
Chapter 5: Data Tables
Chapter 6: Conversion and Validation
Chapter 7: Event Handling
Chapter 8: Subviews and Tiles
Chapter 9: Custom Components, Converters, and Validators
Chapter 10: External Services
Chapter 11: Ajax
Chapter 12: Open Source
Chapter 13: How Do I . . .
Index
Two expert and bestselling Java technology offers provide a thorough and lasting reference for perhaps the most significant J2EE specification in recent memory. Geary and Horstmann cover both the application framework and the component model in detail. Their book features two appendices covering related open source tools such as ANT, JUnit, and Cactus.
Preface.
Acknowledgments.
1.Getting Started.
Why JavaServer Faces.
Software Installation.
A Simple Example.
Ingredients.
Directory Structure.
Build Instructions.
Sample Application Analysis.
Beans.
JSF Pages.
Navigation.
Servlet Configuration.
The Welcome File.
Visual Development Environments.
JSF Framework Services.
Behind the Scenes.
Rendering Pages.
Decoding Requests.
The Life Cycle.
Automation of the Build Process with Ant.
Using the Deployment Manager with Ant.
2. Managed Beans.
Definition of a Bean.
Bean Properties.
Value Binding Expressions.
Message Bundles.
A Sample Application.
Backing Beans.
Bean Scopes.
Request Scope.
Session Scope.
Application Scope.
Configuring Beans.
Setting Property Values.
Initializing Lists and Maps.
Chaining Bean Definitions.
String Conversions.
The Syntax of Value Binding Expressions.
Using Brackets.
Map and List Expressions.
Resolving the Initial Term.
Composite Expressions.
Method Binding Expressions.
3. Navigation.
Static Navigation.
Dynamic Navigation.
Advanced Navigation Issues.
Redirection.
Wildcards.
Using from-action.
The Navigation Algorithm.
4. Standard JSF Tags.
An Overview of the JSF Core Tags.
An Overview of the JSF HTML Tags.
Common Attributes.
Forms.
Form Elements and JavaScript.
Text Fields and Text Areas.
Using Text Fields and Text Areas.
Displaying Text and Images.
Hidden Fields.
Buttons and Links.
Selection Tags.
Checkboxes and Radio Buttons.
Menus and Listboxes.
Items.
Messages.
Panels.
5. Data Tables.
The Data Table Tag.
A Simple Table.
h:dataTable Attributes.
Headers and Footers.
JSF Components in Table Cells.
Editing Table Cells.
Styles for Rows and Columns.
Styles by Column.
Styles by Row.
Database Tables.
JSTL Result vs. Result Sets.
Table Models.
Editing Table Models.
Sorting and Filtering.
Scrolling Techniques.
Scrolling with a Scrollbar.
Scrolling with Page Widgets.
6. Conversion and Validation.
Overview of the Conversion and Validation Process.
Using Standard Converters.
Conversion of Numbers and Dates.
Conversion Errors.
A Complete Converter Example.
Using Standard Validators.
Validating String Lengths and Numeric Ranges.
Checking for Required Values.
Displaying Validation Errors.
Bypassing Validation.
A Complete Validation Example.
Programming with Custom Converters and Validators.
Implementing Custom Converter Classes.
Implementing Custom Validator Classes.
Registering Custom Validators.
Validating with Bean Methods.
Validating Relationships Between Multiple Components.
Implementing Custom Tags.
Custom Converter Tags.
Custom Validator Tags.
7. Event Handling.
Life-Cycle Events.
Value Change Events.
Action Events.
Event Listener Tags.
Immediate Components.
Using Immediate Input Components.
Bypassing Conversion and Validation.
Phase Events.
Putting It All Together.
8. Subviews and Tiles.
Common Layouts.
A Book Viewer and a Library.
The Book Viewer.
Monolithic JSF Pages.
Common Content Inclusion.
Content Inclusion in JSP-Based Applications.
JSF-Specific Considerations.
Content Inclusion in the Book Viewer.
Looking at Tiles.
Installing Tiles.
Using Tiles with the Book Viewer.
Parameterizing Tiles.
Extending Tiles.
The Library.
Nested Tiles.
Tile Controllers.
9. Custom Components.
Implementing Custom Components with Classes.
Tags and Components.
The Custom Component Developer's Toolbox.
Encoding: Generating Markup.
Decoding: Processing Request Values.
Using Converters.
Implementing Custom Component Tags.
The Spinner Application.
Revisiting the Spinner.
Using an External Renderer.
Calling Converters from External Renderers.
Supporting Value Change Listeners.
Supporting Method Bindings.
Encoding JavaScript to Avoid Server Roundtrips.
Using Child Components and Facets.
Processing SelectItem Children.
Processing Facets.
Including Content.
Encoding CSS Styles.
Using Hidden Fields.
Saving and Restoring State.
Firing Action Events.
Using the Tabbed Pane.
10. External Services.
Accessing a Database.
Issuing SQL Statements.
Connection Management.
Plugging Connection Leaks.
Using Prepared Statements.
Configuring a Database Resource in Tomcat.
A Complete Database Example.
Using LDAP for Authentication.
LDAP Directories.
Configuring an LDAP Server.
Accessing LDAP Directory Information.
Managing Configuration Information.
Configuring a Bean.
Configuring the External Context.
Configuring a Container-Managed Resource.
Creating an LDAP Application.
Container-Managed Authentication and Authorization.
Using Web Services.
11. Wireless Clients.
Rendering Technologies for Mobile Clients.
MIDP Basics.
Canvases and Forms.
Commands and Keys.
Networking.
Multithreading.
The MIDP Emulator.
Mobile Communication and Control Flow.
Component Implementation for Mobile Clients.
The Battleship Game.
The Game Rules.
The User Interface.
Implementation.
12. How Do I?
Web User Interface Design.
How do I support file uploads?
How do I show an image map?
How do I include an applet in my page?
How do I produce binary data in a JSF page?
How do I show a large data set one page at a time?
How do I generate a popup window?
How do I customize error pages?
Validation.
How do I use the Struts framework for client-side validation?
How do I write my own client-side validation tag?
How do I use the Jakarta Commons Validator for client-side validation?
How do I validate relationships between components?
Programming.
How do I use JSF with Eclipse?
How do I locate a configuration file?
How do I get the form ID for generating document.forms[id] in JavaScript?
How do I make a JavaScript function appear only once per page?
How do I package a set of tags into a JAR file?
How do I carry out initialization or cleanup work?
How do I extend the JSF expression language?
How do I choose different render kits?
Debugging and Logging.
How do I decipher a stack trace?
How do I find the logs?
How do I find out what parameters my page received?
How do I turn on logging of the JSF container?
How do I replace catalina.out with rotating logs?
How do I find the library source?
Index.