Hi,
There r 2 ways to expire the page or u can say avoid caching.
1) Use HTML default meta tags to avoid caching.
<meta HTTP-EQUIV="Expires" CONTENT="Mon, 06 Jan 1800 00:00:01 GMT">
<meta http-equiv="Cache-Control" content="no-cache">
2)
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<%
response.addHeader("Pragma", "No-cache");
response.addHeader("Cache-control", "no-cache");
response.addDateHeader("Expires", 1);
%>
Hamid Hassan
Software Engineer
visualsoft-inc.com
-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of JSP Insider
Sent: Saturday, March 31, 2001 3:01 AM
To: [EMAIL PROTECTED]
Subject: Re: A tip on how to avoid browser caching problems..
As a quick side note:
The method William states here is the only way to 100% bust the IE 5+ cache.
Hopefully IE 6.0 will pay more attention to the meta tags ;)
Casey
>From: "Ortiz, William J" <[EMAIL PROTECTED]>
>Reply-To: A mailing list about Java Server Pages specification and
> reference <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: A tip on how to avoid browser caching problems..
>Date: Fri, 30 Mar 2001 12:06:26 -0600
>
>We had some problems with caching in our projects too, and the META tags
>did'nt work (we have to use IE exclusively). After some testing we decided
>to add a random number to the JSP URL's, but trying to minimize the
>possibility to zero, we decided to add the timestamp to the url
>(System.currentTimeMillis()). That way you will NEVER hit the same cached
>page twice.
>
>William J Ortiz
>EDS E.Solutions/BlueSphere
>XEEP Buyout
>Phone: (716) 427-6892
>e-mail: [EMAIL PROTECTED]
><mailto:[EMAIL PROTECTED]>
>e
>
>
>-----Original Message-----
>From: Duffey, Kevin [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, March 28, 2001 5:07 PM
>To: [EMAIL PROTECTED]
>Subject: A tip on how to avoid browser caching problems..
>
>
>Hi there all,
>
>I just wanted to pass on a bit of info I finally got working for web
>browsers..just incase some of you out there may be seeing a similar
>situation. On our site, we have 3 "top" tabs that all call the same one URL
>to log in to various parts of the site. The URL the browser sees for all
>three tabs is identical. Therefore, at times the browser does NOT go to the
>server to display the page, but instead pulls it from cache. Before anyone
>replies about META tags and setting headers..I have done all of this. I am
>not sure if MSIE 5 has a bug with this, or not, but I also see this happen
>sometimes on Netscape 6. Therefore I tend to think despite trying to tell
>the browser never to cache a page, it still does. It mostly seems to happen
>if you rapidly click between the tabs that go to the same URL. Most of the
>time it works right..it goes to the server. I think what happens is, BEFORE
>the page is fully displayed if you click on a link again the browser does
>not at that moment have a page in memory with META tags or what not telling
>it not to cache..so it simply pulls the SAME page from its cache. I don't
>think this is the fault of the browser..per se. What I think browsers
>should
>do is NOT allow another link to be clickable when a link is clicked until
>the page is done loading, or the STOP button is pressed. At any rate,
>someone once told me a while back a "trick" to force the browser to go to
>the server EVERY time is to add a random number to the URL. There are
>probably a couple of ways this can be done. However, if you generate a
>dynamic page with links having hardcoded random numbers, its again possible
>that while the page is being loaded, the hard-coded link is being looked at
>and is already in the cache so it reloads that cached page again,
>effectively not working. So what I did is I created a simple javascript
>that
>ALL links would call. Instead of <a href="page.jsp">click</a>, you would do
>something like <a href="javascript: handleLink('page.jsp')">click</a>.
>Then,
>the method would simply add a random number to it, and then cause the
>location to change of the page (or frame). I am not sure if this suffers
>the
>same problem as the hard-coded href links, but it at least is working for
>me
>right now. I have yet to see a cached page come back.
>
>Just thought I would pass that in..if it helps anyone else out there.
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
>For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
>DIGEST".
>Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
>For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
>DIGEST".
>Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets