• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to set up http pragma to be no cache?-urgent please

 
vijitha metpally
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In JSP page- onclick of button I am opening a xxx.csv file which is being created from java dynamically and stored under server. When I am calling this first time it opens up with latest details, but if I regenerate the same name with some changes, new date does not show up. Though on the server the "csv file" date is different.
How to call this "file" from server on each click without getting it from cache? We are using IE, tomcat server.
Thanks
Vijitha.
------------------
 
Richard Barnes
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Given the subject heading, I take it you have tried <meta http-equiv="pragma" content="no-cache"> in your jsp's html head with no success?
 
Steve Snodgrass
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We use the following code in a similar situation and it seems to work well.
<% response.setDateHeader("Expires", 0);
response.setHeader("Pragma", "no-cache");
if (request.getProtocol().equals("HTTP/1.1")){
response.setHeader("Cache-Control", "no-cache");
}%>
 
vijitha metpally
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried this in following way putting it into my code, but no success. I donot know whether I am using it correctly.
<% response.setDateHeader("Expires", 0);
response.setHeader("Pragma", "no-cache");
if (request.getProtocol().equals("HTTP/1.1")){
response.setHeader("Cache-Control", "no-cache");
}%>
<%
//String tempFileName = request.getparameter("studyno");
String tempFileName= request.getParameter("studyno");
String fileName = "";
String test = "";
if (tempFileName != null)
{StringTokenizer tok = new StringTokenizer (tempFileName, " ");
fileName = "http://xxxxxxxxxxxxx/xxxx/xxxx/";
fileName += tok.nextToken();
//fileName += "-" ;
//fileName += tok.nextToken() + "-" + tok.nextToken() + ".csv";
fileName += ".csv";

}

if (fileName != test)
{%>
<script>

window.open('<fileName%','Help','top=0,left=400,height=500,width=600,toolbar=no,resizable=yes,scrollbars=yes');
</script>
<%} %>

Please correct me if its wrong way.
Thanks
Vijitha.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!