JavaServer Faces in Action
Description:Helping front-end developers, back-end developers, and architects understand how they can get the most out of JavaServer Faces (JSF), this guide to the new official standard for simplifying Java web development explains what JSF is, how it works, and how it relates to other frameworks and technologies like Struts, Servlets, Portlets, JSP, and JSTL. Also provided is coverage of all the standard components, renderers, converters, and validators, along with advice on how to use them to create solid applications. The building of complete JSF applications is demonstrated with an in-depth case study covering complex user interface layouts, prototyping, and integrating templates with back-end model objects. Also covered are advanced techniques like internationalization, integration with Struts, and extending JSF with custom components, renderers, converters, and validators.
This book helped me a lot. Very detailed and good examples
I was looking for a good JSF book. I bought this book after reading the reviews. After reading this book I became master in JSF and I am currently architecting a big application for my company using JSF and Web services,,etc.
Thanks for the author for presenting this book with such a detailed explanations and examples. I recommend this book for every one who would like to learn and master the JSF.
Rewarding book - if you work with it
Let me start by pointing out that his target audience includes people who currently develop Java web applications. So its fair then to say that if you are new to JSP and servlets, this isn't quite the book for you. So forget about getting any hand holding with setting up a servlet container or a gentle introduction to JSP actions.
That said, if you know the top end of a web application from its bottom one, and you want to get up to speed on JSF, you're in for a good ride.
1. Architecture (5 out of 5)
This book shines in the area of general architecture. And, I can't say enough good things about Kito's diagrams.
The first diagram of note provides a birds eye view of a JSF application. If you take the time to read through each textual element in the diagram, you'll get a very comprehensive view of your application's place in the world, when implemented using JSF.
His basic introduction to HTTP and Servlets is just that - basic. But his discussion on what frameworks bring to the table is a must read for web developers. That section culminates in another worthwhile diagram - this time a depiction of web application infrastructure as a stack of services. You can clearly see the benefit you accrue from using JSF, vs. say coding using the servlet API. It overlays Struts on there as well, so you get a nice comparison of the two frameworks.
His first application requires a leap of faith. There's a lot of code here just for a simple Hello World application, and its hard to follow along without a reasonable knowledge of what a standard JSP might look like, so you can spot the differences introduced by JSF. It doesn't help that this basic application starts out of the gate with a roar - you're dynamically adding controls to a component using an action listener! Not good.
His class model of the various JSF components is another must see. Its a very informative overview with the UI Component as the center of attention, surrounded by its minions.
The second chapter is another gem - it provides a detailed description of the various classes that comprise JSF. There's a lot to take in, so you'll find yourself returning here after you've read the rest of the book, to help everything fall in place in your mind.
One thing I had difficulty with was that the topics seemed to jump from low level to high level and back again, leaving me a bit winded. The net result is that I couldn't read this very linearly, and had to backtrack ever so often to find my bearings.
For e.g., the first time you get to building a JSF web application is over 100 pages into the book. Fortunately the structure of a WAR is well known, especially to the target audience of this book, so there's no surprises here, other than to note the specific JARs that are required by your JSF implementation.
In the spirit of the topic organization of this book, one of the most engaging chapters on high level architecture is placed right at the end (chapter 11). There again you find a diagram that maps all of JSF's application classes, grouped as component classes, context classes, application classes, and event handling classes. This chapter is a must read as it provides in depth coverage of the APIs that underpin the JSF classes.
The UI Component's singular importance in JSF is honored by an entire chapter. A table classifies components by family (input, output, etc.), JSF implementation class (UIInput, UIOutput), and HTML subclass (HtmlInputText, HtmlOutputLabel).
The components are treated well with the standard components described in sufficient detail. In a rare fashion, he provides examples of how a component tag is rendered as HTML, and presented in a browser. This gives you a clear picture of the additional scripting that is added for a component.
This includes single- and multi- select controls, and their data models set via UISelectItem instances and UISelectItems.
2. Request Processing (5 out of 5)
The life cycle stages are defined clearly and precisely. Its hard to think of any information that might have been missed.
A key concept is that of component and client identifiers - which defines how naming containers influence the name of a child component in the rendered HTML code. This is very clearly portrayed, by yet another diagram that maps the component tree on the server to form components on the client.
All in all, a very satisfying tour of the life cycle.
The coverage of converters and validators is just as complete - including creating custom converters and customizing error messages using message bundles.
3. Templating (4 out of 5)
JSF implementations must support JSP as a templating technology. It's a rare book that doesn't cover the use of JSP actions, custom actions, and JSTL within a JSP page adequately - and this one doesn't disappoint. A key issue with JSP/JSF is that there are certain constraints with using JSF/JSTL tags (such as the tag) - and these are called out adequately. While the coverage is decent, this is not a book on JSP, and it shows.
4. Navigation and Event Handling (3 out of 5)
This information is spread out across multiple chapters - not something that I prefer. While no details are lost its still a bit of work to piece together the whole story. For example, the default ActionListener is covered a number of chapters away from the topic on declaring an action listener.
5. Miscellaneous (5 out of 5)
Interestingly, this is one of the rare books that addresses a rarely considered concept - which JSF implementation should you choose. The RI is a reasonable choice, but the larger question is when an alternative implementation such as MyFaces would be preferable.
The Managed Bean Creation Facility is an interesting implementation of inversion of control - much like Spring - where a configuration file drives the creation and initialization of beans. He actually provides guidelines as to which objects should be constructed using this facility, and which ones would be better served by initialization at web application startup - say using a ServletContextListener, so as not to incur inordinate delays in the middle of a user's interaction. And there's even an example later on in the book, if you didn't get the hint.
Internationalization coverage is pretty complete - in terms of configuration in faces-config.xml (and a warning that without these locale-config elements, the JSF implementation may only support the default locale of the application's JVM); determining the user's locale (using the tag, Java code, or the browser's locale settings); and creating resource bundles to house your locale specific properties.
This book is peppered with relevant tips such as the warning here that you can't use the `.` character in resource bundle keys.
On the client side it describes the use of , especially the use of the basename attribute and how it is set based on where in the classpath the resource bundle is located. For bundles located in WEB-INF/classes no prefix is necessary - since that's the root of the classpath. However, bundles any deeper than that require to be prefixed appropriately.
Another rare topic for a JSF book is the creation of a global error page and registering it in web.xml and as a global navigation rule.
Finally, there's an example of the use of a servlet filter for security.
6. Examples (3 out of 5)
While I typically don't favor overblown monolithic projects that require you to follow along across multiple chapters, the provided example has all the bells and whistles of a typical application you might encounter - including user roles, workflows, and a common toolbar component.
In addition, Kito provides a really interesting approach to application development - by starting out with a dummy user interface using hard coded beans and static navigation outcomes, and slowly evolving the application.
The result is a bit mixed - the first couple of chapters flow wonderfully. However the latter chapters of the examples felt a bit hurried in their execution, especially once we're into the more difficult aspects of JSF development, such as backing bean design.
7. Conclusion (overall score: 4.5 out of 5)
You'll be hard pressed to find a book that has such excellent coverage of so many diverse topics - many that are not JSF specific.
You'll also find gems of practical advice throughout the book - for e.g., that you have 3 alternatives as to where to place your action methods (in your backing beans, within independent action classes, or within service classes) along with the tradeoffs associated with each.
A couple of reservations (albeit subjective):
I'm not a big fan on how the topics are organized. As I read this book, I had to keep jumping back and forth - many many times, and that got to be very tiresome.
I typically like related information to be as physically close as possible, preferably within the same chapter. It is hard to use this as a reference book given the geographical distance between related concepts. This may actually fare better as a search-able e-book.
The example application is very comprehensive and well thought through. However, the example is built over multiple chapters, and the latter chapters are not as coherent as the initial ones. I found the change of pace a bit unsettling.
On the whole, though, its been a satisfying read.
Damodar Chetty (swengsol.com)
A potentially good book let down by poor editing
I agree with some of the reviewers that this book has too many typo errors. Some of the errors are so obvious that they make me wonder whether the book has been proof read before it goes into printing. There are also obvious discrepancies between the code listing and the accompanying explanation. For example, in a few examples, the code listed one thing and the accompanying text just after it refers to something that is not found in the code listing or contradicts the code listing.
The upside about these typos errors is it kept me alert when I come across something that doesn't make sense. It also helped me in my understanding of JSF as I identify and correct the errors.
Nevertheless, it could have been a much better book if it has been professionally proof read and edited.
Poor code examples
This book does not compare to `Core Java Server Faces` first edition by Geary and Horstman. The book provides fery few and not very useful code examples. The content is not very organized. Also, it does not address more advanced topics such as displaying very large result sets.
Not up to the Manning Standard
I purchased this book based on my previously great experience with Manning Press books. I've found other books by this publisher to be easy to read and easy to comprehend. They usually give you just enough background information and then details on different aspects of the subject matter. This book just goes on and on and on about background information and implementation details that are of little use to anyone after they configure their first application. It takes too long to get to the meat of writing JSF applications. And once you get to where the meat is supposed to be, most of that has to be downloaded as a 300 page PDF from their web site. Not very useful at all.
If you are looking for good JSF information, I now use the Core book for information and the O'Reilly book for a quick API reference. If you want examples of great Manning Press books, please check out their `Spring In Action` and `JSTL In Action` books. Both are fantastic reads and full of great information.
Sadly, this particular book left a lot to be desired both as an instructional text or as an API reference.