Review of Chapter 2 of "JSF 1.2 Components by Ian Hlavats"




If you already have experiences in JSF programming you may also had a look at Facelets. Facelets is what makes JSF really usable.

Facelets Components

Ian starts chapter 2 with a little introduction into the history of JSF and why JSP is a worser solution to render JSF pages. Indeed, Facelets is the better alternative, maybe the only one that suits to the ideas of JSF in the end.

You can recognize that Ian has a history in using JSP and this introduction helps experienced JSP developers to understand why they should not use JSP for JSF development. If we have a look at JSF 2.0 this is even more clear. Ed and the other spec guys skipped JSP completely and chose Facelets for the view handling.

Ian did a good job on showing what Facelets offers to have an efficient templating in your projects. The examples show how flexible Facelets is and that you can separate your content from its structure and presentation during rendering.

You even get an introduction how to configure your projects to use Facelets. Something that is missing in my book and can only be studied in the Web application sample ;-) . Most interesting to me was the presentation of the usage of Facelets parameters you can set in the web.xml. You get some information how to get full support for the development environment. But, you also get tips how to use those parameters in production.

Another interesting aspect was the difference between using the “rendered” attribute and the “ui:remove” tag. I’m currently working on a dynamic tags generation project. One aspect with it is to only generate tags in the JSF tree if those are shown in the page.

Chapter 2 is pretty detailed and shows everything important for Facelets templating. I recognized that there are some Facelets tags I’ve never used. Interesting to me: the corresponding sample code shows me why. Facelets supports different design strategies for templating. The chapter is able to show this flexibility of Facelets.

Although, I like the writing of this chapter I miss something that is similar important to me than the templating aspect of Facelets: composite components design. I searched the book for another chapter that may gives some hints to it. I found a section in the JSF 2.0 details (“Next steps” appendix, page 367 ff).

I don’t understand why this is not part of chapter 2. If you study the introdutional section on page 367 it looks like Ian never heard of the composite components support in Facelets 1.x. Well, my book is pretty detailed on this ;-) .

Some details in the chapter that got my special attention:

Page 48, “Comparing Facelets and JSP” Ian references parts of the JSF lifecycle without presenting any details. The JSF lifecycle is one of the details missing in chapter 1. So, this section is pretty difficult to JSF beginners.

Page 79 ff, “Decorating the user interface” “ui:decoration” should be “ui:decorate”.

Page 87, “Summary” “Faceletsand JSP” is not another framework from the community, but needs an extra space: “Facelets and JSP”.

The next chapter will discuss Apache Tomahawk.


Ads
Packt details (worldwide order, also ebook)