myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aleksei Valikov <>
Subject Re: Page Lifecycle
Date Fri, 08 Sep 2006 10:11:47 GMT

> I need to initialize a session scope bean every time I reenter one 
> particular page. How can I do that ? What can I get information about 
> page lifecycle... I think that's the way to understand and solving my 
> problem.

You should write and register a custom PhaseListener. It'll be notified of the 
phase events. You'll get a faces context in event. From the context you can 
check if the view id is your target view id, find your bean in a session (or 
simply resolve a variable with the application variable resolver) and do what 
you want with your bean.

I also needed to make some session-scoped beans be notified of the phase events. 
I've simply written a SessionDispatchingPhaseListener which iterates the session 
attributes and dispatches the phase events (for those attributes that implement 
PhaseListener and listen to the given phase).


View raw message