• 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

Logout Servlet Not working properly

 
Ranch Hand
Posts: 172
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all below is my logout servlet and when I press logout button it does logout the user but it is not clearing the cookie so when press the back button on the browser it shows the home page of the user. What should be done!

 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What the browser does when the back button is pressed is up to the browser. In most cases there it will not send a new request to the server, but will just display the page from its cache.

What problem do you perceive in that behavior?
 
Pranit Sonawane
Ranch Hand
Posts: 172
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the quick reply!
You are right sir. but I have used the same code for couple of other project and have been using the same chrome browser to run them. It works..but only for this time its not working. the same code.

now what is happening?
I go to the logine page
enter my login ID and password
then i get directed to the home page.
now from the same home page i press logout button and i logout properly and get redirected to the login page.
but then if I press the back button, It gets logged in automatically and shows that i have logged in back again.

Now as you said that the browser shows its cashed page. Is there any option to clear that cache also. If yes then please help me.
Thanks!
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One thing you can try is fiddling with the cache headers: https://coderanch.com/how-to/java/NoCacheHeaders

It gets logged in automatically and shows that i have logged in back again.


Is that really what's happening? Or is it merely showing the page you would see if you were logged in? The only way to log back in would be a round trip to the server (which you can check on the server), assuming that the cookies get properly cleared. I suppose it's possible if you had used a GET instead of a POST for the login.
reply
    Bookmark Topic Watch Topic
  • New Topic