• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Caching is not working

 
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had designed a web application with username/password logging in a JSP page and verification process in a servlet. I use sendRedirect to redirect to another JSP page with the message Welcome User. The problem I am facing is I am unable to stop the browser from caching web pages.

After logging in when I use BACK browser button I see the same form just submitted with the same values filled in. This is not my current state. Since user has already logged in when I use the back browser button both username/password text fields should be empty. This is what I am expecting. I used all cache controlling techniques

I included this in my Login JSP page

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">

and in servlets

response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Expires", "0");
response.setDateHeader("Expires", 0);

But nothing is working. I appreciate if anyone can suggest how to solve this issue.
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The pages are not cached if I use response.setHeader("") in my login page. But I don't understand why all these meta tags not working.

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">

Why the jsp page requires setHeader("") methods.
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


if your network has a proxy server or firewall, the webpage is being cached on the proxy server. The browser cache-control would have no effect in the intermediate proxy server.



This is the answer. I am working in a Firewall network.

But how does a firewall cache web pages?
 
Men call me Jim. Women look past me to this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic