• 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

Re: Navigation Restriction

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

I want to prohibit the users to navigate in our web application back and forth using the "Back" and "Forword" button by raising the the error "page not found" in the browser? Should I use HttpSession to handle it?

Thank you very much!

Joe
 
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes, this can be achieved with HttpSession. But take care that the no-cache meta is set in the jsp or else the the page contents will be picked from the cache.
ex : <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> has to be set in jsp.
 
Joe Cheung
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Other than defining <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> in JSP, what else I should do in order to prevent user to navigate using buttons?

Joe
 
Sripathi Krishnamurthy
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you cannot "prevent" the user from using the Back and Forward button. But if you dont want to use HttpSession, you can use a javascript.


put this in the jsp and when "Back" is clicked,the user will be redirected to the page from which Back was clicked.
 
Joe Cheung
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What if I want to use HttpSession to implement it? Could you please provide me with sample code for it?

Thanks!
Joe
 
Sripathi Krishnamurthy
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried running this code in Tomcat(4.1.30) and did not work. As I predicted earlier, it is picking from the cache.
I will try this with websphere and see how it works.

But you can take this code and try for yourself..anyone else in the forum can help?







PS: The HEAD tag before the close of HTML tag is required as a fix to IE. IE wants that to not cache (but still caches..probably another Bill Gates issue)
 
The world's cheapest jedi mind trick: "Aw c'mon, why not read this tiny ad?"
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic