On 1/18/06, Dennis Byrne <[EMAIL PROTECTED]> wrote:
Two potential gotchas with this approach to keep in mind:
* The constructor doesn't get executed until the backing bean is
actually instantiated, so you could miss some phases that
occurred before that happens.
* You have to remember to deregister yourself at the end of
the request -- no matter what happens (even exceptions
being thrown) or you'll cause a memory leak.
I'd think about a different strategy -- register a single phase listener in a faces-config.xml file, have it listen to every phase, and then post an appropriate string documenting the current phase in a request attribute that you could examine from your backing beans.
Craig
There are some folks who would say to have the bean register itself as a PhaseListener in the constructor. In such a case, you could use PhaseEvent.getPhaseId() .
Two potential gotchas with this approach to keep in mind:
* The constructor doesn't get executed until the backing bean is
actually instantiated, so you could miss some phases that
occurred before that happens.
* You have to remember to deregister yourself at the end of
the request -- no matter what happens (even exceptions
being thrown) or you'll cause a memory leak.
I'd think about a different strategy -- register a single phase listener in a faces-config.xml file, have it listen to every phase, and then post an appropriate string documenting the current phase in a request attribute that you could examine from your backing beans.
Dennis Byrne
Craig
>-----Original Message-----
>From: Mike Duffy [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, January 18, 2006 01:04 PM
>To: users@myfaces.apache.org
>Subject: PhaseListener
>
>Is it possible to implement a PhaseListener on a backing bean? I tried to do this but could not
>get it to work.
>
>I'd like to be able to trace the phases as a page loads. Is there some standard way to know what
>phase of the component life cycle has been activated?
>
>Thx.
>
>Mike
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam? Yahoo! Mail has the best spam protection around
>http://mail.yahoo.com
>