aspose file tools*
The moose likes JSF and the fly likes how to remove managedBean from Menu In JSF 2.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "how to remove managedBean from Menu In JSF 2.0" Watch "how to remove managedBean from Menu In JSF 2.0" New topic
Author

how to remove managedBean from Menu In JSF 2.0

Sachin Yewale
Greenhorn

Joined: Feb 02, 2012
Posts: 21
Hi,
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:


Please help me.
Thanks in advanced.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

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.
Sachin Yewale
Greenhorn

Joined: Feb 02, 2012
Posts: 21
Thanks Tim Holloway,
I have view scope to solve my problem.Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to remove managedBean from Menu In JSF 2.0