Author(s): David Geary, Cay Horstmann
Published: May, 2010
If you are a faithful JEE developer about its own specification and you need work and show your skills in the View Layer.Definitively this book is for you to learn the JSF 2.0 specification. Even with some excellents implementations of this specification out there. This book really makes comfortable learn JSF 2.0 quickly.
Therefore consider this book extremelly valuable to learn the basic and standalone specification
The TOC of this book is the follow
- Chapter 01: Getting Started
- Chapter 02: Managed Beans
- Chapter 03: Navigation
- Chapter 04: Standard Jsf Tags
- Chapter 05: Facelets
- Chapter 06: Data Tables
- Chapter 07: Conversion And Validation
- Chapter 08: Event Handling
- Chapter 09: Composite Components
- Chapter 10: Ajax
- Chapter 11: Custom Components, Converters, And Validators
- Chapter 12: External Services
- Chapter 13: How Do I . . . ?
Chapter 01: Getting Started
An excellent and valuable chapter to start this journey. Quickly the chapter start with the section Why JavaServer Faces?. Explaining the JSF parts and introducing a sample code about a simple login case. The source code to get working this login is available including its explanation for each file. Well done.
Explanation about the Directory Structure is available too. Therefore with many images you know where put your files.
How Building and Deploying the JSF Application is explained in two sections with step instructions and commands. Here the author uses GlassFish working on Unix/Linux.
A quick variation of this login example is available and working with Ajax.
An important section is JSF Framework Services where the components of JSF are explained, even how they work. An image for a better understanding is included too. Same appreciation for the section Rendering Pages where you learn clearly how work this process.
Practically to finish this chapter the JSF’s Life Cycle is well covered, explaining each cycle. Again an image for a better understanding is available.
Chapter 02: Managed Beans
Here the author explain deeply how use and configure a Bean to be used for JSF. Some patterns and many annotations are covered throughout this chapter. Even how to work with Value Expressions is covered.
The sample code for this chapter is about of a Quiz Form where again each file related is well explained. The new in this book is the use of annotations like @ManagedBean and @SessionScoped. Even more, CDI Beans is covered.
The follow sections are covered too:
- Message Bundles
- Messages with Variable Parts
- Setting the Application Locale
A long covering is about Bean Scopes, where the follow scopes are available (working with annotations)
- Session scope
- Request scope
- Application scope
- Conversation Scope
- View Scope
Bean Life Cycle Annotations is covered too. Therefore working with the @PostConstruct and @PreDestroy annotations. The old school is covered too. Therefore how work with JSF with XML configurations is available in many pages
Chapter 03: Navigation
Re using the Quiz Form, this chapter cover deeply how to configure and work with navigation. Many images for a better understanding is available too. The source code and settings are available through many pages and they are very easy to be understand. the h:commandButton tag is used many times for navigation purposes.
Even how to with REST Navigation is available. The code is not complex and is easy to understand
Chapter 04: Standard Jsf Tags
A chapter based mostly on tables, many of them, indicating where these tags going to be covered throughout the book, most of these importants are:
- JSF Tag Libraries
- JSF Core Tags
- JSF HTML Tags
- Basic HTML Tag Attributes
- HTML 4.0 Pass-Through Attributes
This is a long chapter. The purpose is show in action many of these tags. Many images showing the final output is available too
Chapter: 05 Facelets
Starting quickly with an introduction about Facelets, including how they can be grouped by categories and even including a table explaining some tags. A sample application about Logging into the planetarium is available working with Facelets. You can see how useful are the templates used. The source code is well explained for each file.
This chapter is not long but has a good amount of sample code available.
Chapter 06: Data Tables
Working closely with the tag h:dataTable and its attributes in many situations throughout the chapter.The authors start with a simple case using a table and afterwards introducing throughout the chapter according with the advance many tables listing many tag elements like h:dataTable and h:column with its attributes, for these attributes its respective explanation for each one is available. Then introducing a sample code in action of many of these elements.
Styles working with CSS is covered too, by row and by column. Events with tables are available too like editing and deleting rows. Even more, a sample working with a database is available too.
Other features covered are:
- Sorting and Filtering
- Scrolling Techniques
Each example include the source code with its respective explanation for each file. A lot of source code to learn is available.
Chapter 07: Conversion And Validation
A long chapter and of course an important concern for any application in the real life. The chapter start with a section named Overview of the Conversion and Validation Process, based on important theory and even including an image for a better documentation.
Ok time to coding!. Covering about Conversion of Numbers and Dates is introduced with two samples working with the tags f:convertNumber and f:convertDateTime respectively. Later including two tables listing its attributes and explanation for each tag.
The follow important section is Conversion Errors, well covered, even including a valuable table named Standard Conversion Error Messages, based and listing many javax.faces.converter elements with its respective explanation.
With all these topics covered a complete example is included, valuable source code and explanation.
Now is the turn to cover about Using Standard Validators, covering many important things like:
- String Lengths and Numeric Ranges (even including a table)
- Required Values
- Displaying Validation Errors (including a big table listing many items from javax.faces.validator)
With all these points covered a complete sample code working with all is available. Interesting explanation.
Now is the turn to work with Bean Valitadion JSF 2.0, working with annotations based on Bean Validation Framework (JSR 303), including a table showing the most important annotations with its respective explanation, again other sample case is included working with these annotations.
The rest the chapter could be complex, is about create your custom Converters And Validators. A lot of source code and theory is available practically through of twenty eight pages!
Chapter 08: Event Handling
It is an important chapter, practically starting with the section Events and the JSF Life Cycle where is available an important image showing this cycle.
The chapter cover the follow sections:
- Value change events
- Action events
- Event Listener
- Immediate Components
- Phase events (short covering)
- System events (Even including a table listing many important Event classes with its respective explanation)
Practically each one working with a sample code with its respective explanation and many images to show how each application work.
Many attributes and elements are covered throughout the chapter like:
A good amount of source code is available for this section
Chapter 09: Composite Components
Starting quickly with the section The Composite Tag Library including a table named Composite Component Tags listing many items with its respective explanation.
This chapter work closely with many sections covered together by advanced of many of them like:
- Implementing Composite Components
- Configuring Composite Components
- Attribute Types
- Manipulating Server-Side Data
- Exposing a Composite’s Components
- Exposing Action Sources
All these sections include its own source code with its respective explanation and many times including images of the execution result output. A lot of source code is included in this chapter
Chapter 10: Ajax
Practically in these days all web application need Ajax. This is a valuable chapter you must have to read.
The first section is Ajax and JSF including an important image about the follow situation An Ajax request for validating an input field, you can see clearly how Ajax works, the follow section is The JSF Life Cycle and Ajax including two important images:
- The execute portion of the JSF life cycle
- The render portion of the life cycle
Then the sample code is introduced working with the f:ajax tag, even this section includes a table named f:ajax Tag Attributes, for a better understanding
Two sample cases is introduced quickly about Ajax Field Validation and Ajax Request Monitoring each one with its respective source code and explanation and even including two tables about Data Object Attributes.
Other section available is Ajax Responses including an image about Viewing an Ajax response using Firebug. Even including a table about JSF Ajax Response Elements including a snippet code for each element.
Other short sections covered are:
- Queueing Events
- Coalescing Events
To finish the chapter Using Ajax in Composite Components is covered with a good amount of source code. The sample used is represented with an image named An autocomplete composite component
Chapter 11: Custom Components, Converters, And Validators
Perhaps it is the longest chapter. It is an important chapter to be consider definitively for your aplication
Practically starting with the section Implementing a Component Class where the follow elements are explained: UIOutput, UIInput, UICommand and UIComponent. Even including a valuable image about JSF component hierarchy. In the sample code the spinner component is used, images of its execution is available too, here the author work with the namespace xmlns:corejsf, therefore working with the element corejsf:spinner.
The follow section is Encoding: Generating Markup explaing the
encodeBegin, encodeChildren, encodeEnd methods. Even more, explaining some methods of the follows elements:
Here the author create a class named UISpinner which extends the UIInput class
The sections The Tag Library Descriptor and Processing Tag Attributes are covered with concrete theory and its respective source code with its explanation
We have two sections with valuable source code and with its respective explanation, these are:
- The Sample Application (Working with a spinner)
Same appreciation for these sections
- Partial State Saving
- Building Ajax Components
For many of these last sections the source code is working with a lot of classes from javax.faces… package and the namespace corejsf
Chapter 12: External Services
Important chapter for your consideration, starting quickly with the section Database Access with JDBC, working with our old friend the DataSource interface, futhermore covering about:
- Connection Management
- Using Prepared Statements
For the sample application Apache Derby is used with GlassFish, steps instructions are available for Derby and some images about Configuring a Database Resource in GlassFish too, with all this, the source code is introduced and explained, the sample case is about a Login page.
A variation of the previous case is now working with JPA. Therefore the new source code is introduced and explained, an Entity class is used. Even more the author includes Using Managed Beans and Stateless Session Beans and Stateful Session Beans (working with CDI). Respective source code available with its respective explanation.
Other section available is Container-Managed Authentication and Authorization where settings configuration on web.xml is included. The auth-method types are covered quickly with its respective images to show the differences between them, these are FORM and BASIC. Even more, an image to configure GlassFish about realm is available too. A valuable table named Realm Settings for the Database is included too. It is tested with a Web Browser and Lynx. The source code is included and explained.
Other section included is Sending Mail. Again, an image to configure GlassFish about Specifying mail session parameters in GlassFish is included. Other table named Mail Session Parameters is available too. Source code included with its respective explanation and some images about the execution for this sample.
The last section is Using Web Services working with a WSDL file for the CDYNE weather service. JAX-WS is used for this sample too. The section is not long but again it includes the source code with its respective explanation and some images about the execution for this sample.
Chapter 13: How Do I . . . ?
This chapter is really valuable how reference. Below the questions available
- How do I find more components?
- How do I support file uploads?
- How do I show an image map?
- 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 pop-up window?
- How do I selectively show and hide parts of a page?
- How do I customize error pages?
- How do I write my own client-side validation tag?
- How do I configure my application?
- How do I extend the JSF expression language?
- How do I add a function to the JSF expression language?
- How do I monitor the traffic between the browser and the server?
- How do I debug a stuck page?
- How do I use testing tools when developing a JSF application?
- How do I use Scala with JSF?
- How do I use Groovy with JSF?
Practically each solution is based with valuable theory, source code and important images for a better understanding
What I liked:
- Valuable and a huge amount of source code!
- A lot of theory and explanation available
- You can read the entire book comfortably
- Easy to understand a 99% the source code throughout the book
- Practically for each sample code is available an image that represent the application’s structure, therefore you know where each file should be located
- Many images showing the execution output of many sample code
What I disliked: