Friday, January 22, 2010

JSF PhaseListener Example

I have been reading a book called JSF 1.2 Components from Packt Publishing to do a review. While reading the book, I thought about the numerous code examples that I have written over the years. I decided to publish this example based on JSF 1.2 and Facelets 1.1.14 using NetBeans 6.7.1.

This example demonstrates the use of a PhaseListener which is set in the web.xml file. It also includes a component tree renderer which is also a PhaseListener. Facelets includes a component renderer for debugging purposes. You must include the <ui:debug/> tag in your xhtml file to use it.

Note: The component renderer for debugging components has a Javascript error which was introduced in Facelets 1.1.12 through 1.1.14 which will not render the Component tree. You must use either Facelets 1.1.11 or 1.1.15.B1 to have the component tree render.

Here is the sample code on Bitbucket: JSFPhaseListeners

4 comments :

randy said...

So this logs before and after every phase?

Randy

John Yeary said...

Yes. The PhaseListener intercepts all phases. After that you decide on which phases to take action on, if any.

Greg said...

How do I download the code to this example?
The link you have redirects me to login but I see no where to create an account.

Please advise. Thanks

John Yeary said...

Google moved from Google Web to Google Sites, and broke the links. It is fixed now.

Popular Posts