On Wed, 2006-01-18 at 10:04 -0800, Mike Duffy wrote: > 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? >
I do this by implementing an independent class as the phase listener. When a phase callback occurs, it stores the current phase in a static ThreadLocal variable. A single HTTP request is always serviced in a single thread, so this works nicely. A static method is then provided for any code that wants to query the current phase (for the current thread): String phaseId = PhaseTracker.getCurrentPhase(); Regards, Simon

