I had the pleasure to review JavaServer Faces: Introduction by Example by Josh Juneau which has been published by Apress in December 2014.
The highlight of the book was the simplicity with which Josh has covered some of the most complicated topics related to JavaServer Faces (JSF).
I like how smoothly and seamlessly he can transition from the simple recipes to the more involved and detailed discussions in each chapter. I also
appreciated the way he covers every topic as a recipe and has an example source code and a detailed explanation for each recipe's code.
Here are the details of each chapter in the book
Chapter 1: Introduction to Servlets
Chapter 1 covers detailed introduction to Servlets with examples from setting up the Java Enterprise environment, installing GlassFish,
developing the first servlet, to packaging and deploying the servlet. It also discusses about topics related to dispatching requests,
filtering web requests, adding listeners, downloading files etc. There is a section that covers Servlet 3.0 Non-Blocking I/O and Async APIs
which will be very beneficial for readers interested in processing requests asynchronously and not having to block for a long running task
to complete and send the response.
Chapter 2: JavaServer Pages
Chapter 2 covers JavaServer Pages(JSP) and starts with a simple JSP. It covers the lifecycle of the JSP, embedding Java in JSP page,
embedding expressions in EL, creating custom JSP tags, error handling, disabling scriptlets in JSP pages etc. I particularly liked the
database sample which shows how to create an input form for a database record and loop through the records.
The first two chapters covered the initial foundation extremely well to get started with JavaServer Faces in Chapter 3.
Chapter 3: The Basics of JavaServer Faces
This chapter begins with developing a simple JSF example. It covers details on breaking down a JSF application which consists of the
components for a JSF application. It covers the life cycle of a JSF application. Further sections discuss on writing a managed bean
and access it within a JSF view using EL. The Managed Bean Scopes section was very informative. The building sophisticated views
with components covered how to build well formed views with JSF and HTML. It also highlighted navigation techniques within JSF applications
and how to validate inputs in the application before they can be persisted.
Chapter 4: Facelets
Chapter 4 starts off with Facelets which is the default view definition language since JSF 2.0. Josh shows how to use Netbeans IDE
to create Facelet Template view and then how to apply the template to a view. This section also covered how to reuse a
component and its resources in any JSF view within the application by utilizing the facelets ui:component tag.
Also it covered handling variable length data with ui:repeat tag
I particularly liked the section on debugging the view layout with ui.debug tag
Chapter 5: Java Server Faces Standard components
This chapter focusses on JSF component library and shows how to use external component libraries. It showed how to use
Bean validation with JSF. Using a concrete example of subscribing to a news letter the chapter demonstrates various
topics layering one on the other. This is one of the best chapters of the book.
Chapter 6: Advanced Java Server Faces and Ajax
This chapter delves into using JSF components with Ajax. It covers Ajax validation using f:ajax tag to add immediate validation
server logic in the JSF managed bean. Additionally it covers how to make partial page updates which was very interesting.
This chapter demonstrates how to listen for system life cycle events such as PreDestroyApplicationEvent andPostConstructApplicationEvent.
Another example is how to get periodic updates to pages without doing a manual refresh using the poll component. The section on
developing JSF components containing HTML5 was very good read which demonstrated how to create an HTML5 video component
from a JSF composite component. It also covers a flow instance which is a new feature in JSF 2.2 allowing sharing of information
between the views of a flow instance.
Overall I found that this book was a great source of information for JavaEE developers wanting to develop component based
user interfaces running on browsers for rapid development and deployment.
I would highly recommend this book to anyone who wishes to know about JavaServer Faces from scratch as well as advanced users
who want to get more acquainted with the nuts and bolts of newer features.