In our application we have a portlet defined for each of the user tabs.
- We are using JSF 1.2 +Portlets.
- I want to clear the FacesContext Session managed beans when user
navigates from one tab to another.
What would be the best way to achieve this?
- Is there any portlet unload function available where we can write
code to remove session managed beans before user leaves the
tab(portlet).
As you’re using JSF 1.2 and thus cannot take benefit of the new view scope which is designed for exactly this purpose, your best bet is to grab MyFaces Tomahawk or MyFaces Orchestra. You only need to put your “view” scoped beans back from the session scope into the request scope.
If you’d like to simulate the new JSF 2.0 view scope, i.e. the bean lives as long as you’re interacting with the same view, then you need to add Tomahawk’s
<t:saveState>to the view referencing the request scoped bean.If you’d like to simulate the new CDI conversation scope, which can span multiple views within the same browser tab, then you’d need to integrate Orchestra.