• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • 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: 25646
183
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.
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic