• 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

disable browser caching not working

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
I have a application made on servlets mainly,but i use xslt for display purpose.If any user make any entry in the application he can use the back button of browser to go to periovus page and redo the entry, i want to disable that, is there any whay i can disable the chache in browser.

i used the following line also.
but not working
// Set standard HTTP/1.1 no-cache headers.
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");

// Set IE extended HTTP/1.1 no-cache headers (use addHeader).
response.addHeader("Cache-Control", "post-check=0, pre-check=0");

// Set standard HTTP/1.0 no-cache header.
response.setHeader("Pragma", "no-cache");
please help
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try disabling the back button...
 
felix thomas
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how can u disable back button using servlets
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Realistically, there is no way you can guarantee that a user will never resubmit an old form. Even if you disable the "back" button, there's usually a context menu option to go back, or the user can bookmark the form page and go back to the bookmark, or type in a "javascript" URL, etc. etc.
A much more robust solution is to track on the server which forms have been submitted. Generate some sort of "transaction id", and pass it to the browser as a hidden form parameter. Then when the form is submitted, before it is procesed on the server, check on the server whether that id has already been received and dealt with.
If you take this approach you can let the user be free to configure his/her own browser, and you can issue a friendly warning message if a form is submitted more than once.
 
felix thomas
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mr Frank,
Could u show me an example or code on how to check the transaction id on server.I understood the concept but cannot understand how to implement it,
Thanx,
Felix
 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi felix
My 2 cents..
If we go with suggestion brought up by Frank, then we would have to,
- store all the submissions for a while for transaction id
- also, it depends on what we choose as transaction id. for e.g. if we have chosen a user name that logged in then we have to make sure that we remove the transaction id from our "submitted requests" table as we want user to submit the form again in future. I hope I am able to convey my thoughts here.
so in essence we can choose any mechanism for the transaction id but we have to make sure of certain things about managing it depending upon our application context/requirements..
Also, there are many disucussions about how to disable back button on Javaranch. So you can look for them if you wanted to dig into details about approaches/issues...
Regards
Maulin
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic