Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Re: Servlet Problem

 
Joe Cheung
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
I am new to Servlet. I want to ask if I write 2 servlet pages, A and B, I write a button in A such that I can go to B by clicking the button. However, I don't want someone can go back to A by clicking Button "Back" in Browser. What should I do? This suggestion actually came from my observation of many web sites in whcih I cannot go back once I log in the web sites and error message "The page is expired" prompted when I click the Button "Back" in Browser.
Regards,
Joe
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"The page is expired" message is a browser message that cannot be controlled by any server-side component, including web servers, servlets, jsp, etc.

The reason that you get this message is that the page you are going "back to" was constructed as a result of an HTTP POST operation (a form submission whose method attribute was set to "POST").

Also note, it's not that you cannot go back to this page, it's that you cannot view the page again until you repost the form submission.
 
Joe Cheung
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Mike Curwen,
Thanks for reply. Now I am more understandable to the servlet operating theory. If I really want to disallow user to go back to the previous servlet by clicking "Back" button in browser, what should I do?
Regards,
Joe
 
Malhar Barai
Author
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Joe Cheung:
Dear Mike Curwen,
Thanks for reply. Now I am more understandable to the servlet operating theory.
If I really want to disallow user to go back to the previous servlet by clicking "Back" button in browser, what should I do?
Regards,
Joe

This has been discussed many a times in this forum, kindly do a search on it, & you would come across many threads.
hth
MB
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic