I am working on JSF 2.0 Application.I have created a Menu using rich:dropDownMenu. And for some pages i put managedBean in session scope . but when i click on the the one menu item and then after some time other and again come back to prev menu link it keeps its state. i know i need to remove managedBean from session for this . but i dont understand where to put that code.
My menu code is:
Don't mix JSF and JSTL. It generally does not work very well. And, in any case, the RichFaces menu doesn't need looping of any kind since it works with menu item collections models.
Removing a session-scope managed bean in JSF can be a bit of a problem since JSF has no direct support for that. It's usually easier and cleaner to keep the bean and wipe it clean. A common construct I employ is this:
Since I made init() a public method, I can inject this bean into any beans that will navigate to it and have them invoke init() as part of the navigation action.
An alternative that would probably work for the menus is to use View scope instead of session scope.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Feb 02, 2012
Thanks Tim Holloway,
I have view scope to solve my problem.Thanks.
subject: how to remove managedBean from Menu In JSF 2.0