File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes session variable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "session variable" Watch "session variable" New topic

session variable

roon ray

Joined: Aug 16, 2006
Posts: 7
I am setting a session variable in every page depending on if a user clicks a button or not. The pages work fine if I use the navigation button that I have on the designed website as I am setting the session variable in one of the taglibs.
But when I use the forward and back button of the browser, the session variable does not hold the value as the page is loaded from cache.
I tried clearing out the cache using meta tags in JSP but still it appears to me that the pages are not getting loaded as my printlns are not printing anything.
Can someone suggest some other way to handle this. I tried the clearing out of cache but that does not work.
Any help will be highly apperciated.
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
I could not get the requirement properly but I am still answering to best of my knowledge about your question.

If you web application has navigation buttons then why do not you disable the browsers back button.
You can put a javascript : history.go(1); on page load event of every page.So as soon as you press the back button it will take you to the page from which you have clicked the back button.In this way you are staying in the same page.
I do not know whether this will work will dynamically generated pages.

Rahul Bhattacharjee
LinkedIn - Blog
I agree. Here's the link:
subject: session variable
It's not a secret anymore!