Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Caching is not working

 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic