Review of Chapter 3 of "Apache MyFaces 1.2 Web Application Development by Bart Kummel"

The third chapter is presenting Facelets. Seems to me that it is a better introduction to Facelets than we have seen with Ian’s book.

Facelets

Bart also starts with the JSP vs. Facelets rendering stuff. But, this is much shorter when having a look at the advantages. He continues with the installation/configuration of Facelets for JSF projects. Next is templating, then composite components and finally the overview of the Facelets tags.

The writing is brilliant, because there is no useless information. The writing is compact but you are able to follow the story line and get a useful result finally. After reading the chapter you are able to use the most important parts of Facelets in your project. Only the Facelets tags overview is a bit lame and looks like a copy of the Facelets users guide.

Nevertheless, Bart mentions some interesting aspects of Facelets, that let me judge him as a Facelets power user ;-):

  • Using comments He shows why you have a special parameter for comments handling in the web.xml and how Facelets influences the rendering via the output.
  • Named entities Although Facelets uses the xhtml extension it is not able to process all entities from the XHTML standard. This is because Facelets uses a SAX parser, that can only process XML. Bart shows how to define named entities within XML.
  • Static functions Facelets allows you to define static methods in backing beans and use those via your own taglib in Expression Language (EL) terms. A nice features I never used before, but an elegant one to extend the usage of the EL.
  • Inline text This is something I liked from the very first moment using Facelets. You can output text without using a JSF tag, but with full EL support. This allows you to do things you can not do with JSF tags as easy, like simple output of HTML tags from a backing bean.

If you want to have a professional introduction to Facelets without wasting time, have a look at this chapter. The next chapter introduces Tomahawk, the first JSF component set based on MyFaces.

Ads
Packt details (worldwide order, also ebook)