Book Image

Mastering JavaServer Faces 2.2

By : Anghel Leonard
Book Image

Mastering JavaServer Faces 2.2

By: Anghel Leonard

Overview of this book

Table of Contents (20 chapters)
Mastering JavaServer Faces 2.2
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
The JSF Life Cycle
Index

Facelets' programmatic aspects


In the second part of this chapter, we will focus more on several programmatic aspects of Facelets. We will start with a new feature of JSF 2.2 regarding FaceletFactory, which produces Facelets relative to the context of the underlying implementation.

FaceletFactory considerations

In JSF 2.0, the FaceletFactory class was not accessible via the standard API for accessing factories, FactoryFinder. This means that something like the following line was not working:

FaceletFactory faceletFactory = (FaceletFactory)
FactoryFinder.getFactory(javax.faces.view.facelets.FaceletFactory);

But starting with JSF 2.2, the preceding snippet of code should work. At least this is what the list of JSF 2.2 features said. Unfortunately, it doesn't work because the specification doesn't contain a class named javax.faces.view.facelets.FaceletFactory. In Mojarra 2.2.6 implementation, the FaceletFactory class doesn't even exist; there is a public class named com.sun.faces.facelets.impl...