Tag Archives: Java Server Faces

JSF2 Tutorials Videos :How to Create a Simple Java Server Faces (JSF) Application WAR File for J2EE/JEE5 Deployment

Here is another awesome video from Cameron Mckenzie on JSF2.

Cameron Mckenzie is the author of JSF2 Made Easy

In his book – JSF Made Easy helps you learn quickly as it takes you through a number of fun and easy to understand examples that demonstrate both the power and simplicity of the JSF framework. The examples in the book are clear and concise, relatively small in size so they are easily reproduced, and they hit the core concepts hard without ever distracting you with unnecessary code, superfluous classes and peripheral concepts that detract from your learning.

Get this book from amazon.com

The below video tutorial demonstrates how to create a proper war structure, do a basic web.xml deployment descriptor configuration for the FacesServlet that implements the FrontController Design Pattern, and it shows a simple faces-config.xml file.

JSF Phase Listeners – Important Points (Short Notes on What When How )

What is JSF Phase Listener?

A Phase Listener is a class that simply implements javax.faces.event.PhaseListener
and registers itself with the JSF implementation and will be invoked before and after each phase
in the JSF lifecycle that the implemented phase listener wants to be notified about



How to Define JSF Phase Listener?
It’s a simply two step process

  •      Write a java class that simply implements javax.faces.event.PhaseListener
  •      Registering it with Java Server Faces in faces-config xml file

     We can implement multiple phase listeners and register in faces config xml file and the order of registration of listeners determines the order in which these listeners will be called during the JSF lifecycle

When to Use?
JSF Phase Listeners can be used to Add Custom processing logic into the JSF lifecycle.
Phase listeners can be used as a perful debugging tool
We can register a listener with the JSF implementation
and the implementation will then notify our listener at both before and after the phase
that our listener is interested in.

Other Notes;
JSF guarantees that if a listener’s beforePhase() method completes successfully,
then its afterPhase() will also be called as normal even if a subsequent listener beforePhase()
method throws an exception. Also important thing to remember is that the JSF Listeners will add
overhead to the JSF lifecycle process and it’s important that we use as appropriate.