• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

session issue

 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,

i have a web page corresponding to which the managed bean is in session. Problem is when i navigate to other page and then again comes back to this page all fields are populated with the values when i left that page earlier. Can any thing be done so that when ever i come to this page i find all fields blank or in a state when one comes to this page for the very first time. I think problem is because of session.


Any pointer in this reagard will be highly helpful.
 
Saloon Keeper
Posts: 28133
198
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
You think correctly. A session-scope object is constructed once and remains until the session is invalidated unless you explicitly remove it from the session context. To be precise, it retains state.

One of the things that complicates this is that if the session object was reset, the "back" button wouldn't operate as expected. However, this can be annoying when moving forward, because what you want in your particular case is to reset the state of the object.

Probably the best way of resolving this is to supply the bean with a public method named "reset()" or "init()" or something like that. Then inject the session object into whatever object controls navigation towards whatever page(s) use the session scope object. Invoke init/reset() on the pbject as part of the action process that sends the user to the session-scope object pages.
 
Kumar Gaurav
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could you please elaborate it further..
 
When all four tires fall off your canoe, how many tiny ads does it take to build a doghouse?
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic