• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to remove managedBean from Menu In JSF 2.0

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Saloon Keeper
Posts: 27807
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sachin Yewale
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Tim Holloway,
I have view scope to solve my problem.Thanks.
 
reply
    Bookmark Topic Watch Topic
  • New Topic