Chapter 10. Facelets

In this chapter, we will cover:

  • Installing Facelets under JSF 1.2 (or JSF 1.1)
  • Facelets aliasing components
  • Facelets templating
  • Creating composition components in JSF 2.0
  • Passing sub-elements to composition components
  • Passing actions to composition components

Introduction

Our goal for this chapter is to cover the main aspects regarding Facelets technology. As you probably know, Facelets is the name behind JavaServerTM Faces View Definition Framework and basically it represents a page declaration language that can be used with JavaServer Faces technology (in many aspects it is similar to Tapestry). Most usually, Facelets is used to build JavaServer Faces views using HTML style templates and to build component trees (not a servlet as with JSP). While doing this, it provides some important features, such as the following:

  • Reusability of code and ease of development
  • Functional extensibility of components
  • Optimized compilation time
  • Compile-time EL validation
  • High-performance rendering
  • Support for the XHTML language for web pages
  • Support for unified expression language
  • Components and pages can be templated
  • Facelets isn't dependent on a JSP container
  • Support for JavaServer Faces Facelets Tag Library
  • Support for JavaServer Faces HTML Tag Library
  • Support for JavaServer Faces Core Tag Library
  • Support for JSTL Core Tag Library
  • Support for JSTL Functions Tag Library
  • Support for tags for composite components (you can declare custom prefixes)

If the previous list was not a strong argument for you to try Facelets in your applications, then you probably should know that starting with JSF 2.0, Facelets is a part of JavaServer Faces specification and the recommended and preferred presentation technology to use in conjunction with JSF.

In this chapter, we will start by with a recipe that describes how to install Facelets (for JSF under 2.0) and we will continue by exploring features like templating, creation of composition components, passing sub-elements and actions to composite components, and more.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset