Coming Up for Air

Book Review: JSF 2.0 Cookbook

Friday, August 20, 2010 |

image::https://www.packtpub.com/sites/default/files/imagecache/productview/9522.jpg

Packt Publishing recently released a book titled JSF 2.0 Cookbook, by Anghel Leonard. When I first heard about this book, I was really anxious to get my hands on it. I really like the cookbook concept, so I was excited to see a work in that vein published for JSF. Packt recently sent me a copy to review, so, having read most of the book, here are my thoughts.

First off, I’ll be upfront: I have not read the whole book, but I don’t think that’s a problem. Cookbooks aren’t meant to be read cover to cover, necessarily. While you can certainly do that, these types of books are intended to be a reference. When you have an issue, you look in the table of contents to find the "recipe" that covers your issue, and jump to that page. That’s what I did with this book, mostly. I looked up the recipes for issues I most often have trouble with. I did, though, read almost all of the custom component chapter, as that’s area that holds a lot of interest for me. I’ll give that one special attention in a moment.

Each recipe, follows the same basic pattern. It starts with a basic summary of the problem, then goes in to "Getting ready," "How to do it…​," "How it works…​" and "See also." There are minor deviations along the way, but that’s the basic gist. In the Getting Ready section, the author details how the recipe was created (NetBeans 6.8, Mojarra 2.x, and GlassFish v3, showing the author has great tastes : ), so new users can get a sense of what might help work through the recipe. The How to do it section is pretty detailed, with LOTS of source code. Much of the markup is still using JSP, which is a shame since JSP is all but formally deprecated with JSF 2.0 (Facelets being the de facto standard), but you shouldn’t have any major issues applying what you see to a Facelets page. The How it works section that follows does a great job of explaining…​err…​ how it works, which I think is really important. How to do something is rarely enough. If you understand why to do something and how that something works, you’ll be better equipped in the future for similar, but slightly different issues. This section does a good job of that.

The only area of the book I want to comment on specifically is Chapter 5, Custom Components. Of all the areas in JSF, component authoring has always been a favorite of mine. I am far from being a leading expert, but I’m pretty comfortable with it and really enjoy it. Chapter 5, then, was one of the first things I turned to. The author does a great job of giving a variety of examples using validators, ajax, etc. A big glaring flaw for me, though, was the discussion of the JSF lifecycle, a very important topic for component authors. In the graphic on page 130, encoding is shown as happening in the Apply Request Values Phase, and decoding is shown as happening in the Render Response Phase. Unless I’m sorely mistaken, that’s exactly backwards. Despite that error, the chapter itself is extremely helpful. I would advise, though, that if you are looking to learn component development, to try JavaServer Faces 2.0: The Complete Reference by Ed Burns, and Chris Schalk, or Core JSF by David Geary and Cay Horstmann. That’s not to belittle this book in anyway. The Geary/Hortsmann and Burns/Schalk books are meant for different purposes. JSF 2.0 Cookbook has a slightly different purpose, which is complementary to the first two, and which it does well, I think.

Overall, I think this is a really good book. Though not perfect, it provides a lot of value to the JSF developer. From beginner to expert, I think there is enough in this book to help just about everyone out of a jam from time to time.

Search

    Quotes

    Sample quote

    Quote source

    About

    My name is Jason Lee. I am a software developer living in the middle of Oklahoma. I’ve been a professional developer since 1997, using a variety of languages, including Java, Javascript, PHP, Python, Delphi, and even a bit of C#. I currently work for Red Hat on the WildFly/EAP team, where, among other things, I maintain integrations for some MicroProfile specs, OpenTelemetry, Micrometer, Jakarta Faces, and Bean Validation. (Full resume here. LinkedIn profile)

    I am the president of the Oklahoma City JUG, and an occasional speaker at the JUG and a variety of technical conferences.

    On the personal side, I’m active in my church, and enjoy bass guitar, running, fishing, and a variety of martial arts. I’m also married to a beautiful woman, and have two boys, who, thankfully, look like their mother.

    My Links

    Publications