Another possibility for preventing caching is to forcibly set the last-modified date of the servlet/JSP. You can always use the often-suggested (and well-archived) solution: <% response.setHeader("Pragma", "No-cache"); response.setHeader("Cache-Control", "no-cache"); response.setDateHeader("Expires",0); %> SnowWolf Wagner, in an article at http://www.orionsupport.com/articles/defeatingcache.html, mentions the following snippet as being effective as well, especially for defeating caching proxies: <%! // return current time to proxy server request public long getLastModified(HttpServletRequest request) { return System.currentTimeMillis(); } %> This may aid the browsers, even without the proxies, as well. >From: ems vasudevan <[EMAIL PROTECTED]> >Reply-To: A mailing list about Java Server Pages specification and >reference <[EMAIL PROTECTED]> >To: [EMAIL PROTECTED] >Subject: Re: How to prevent IE from cacheing a JSP page >Date: Thu, 17 May 2001 19:02:17 -0700 > >Try this .It will work.I have used it to prevent >caching in JSP. >with warm regds, >E.M.S.vasu >--- "Middleton, Jorge Luis" <[EMAIL PROTECTED]> >wrote: > > Did you try with this header? > > > > response.setHeader("Pragma", "No-cache"); > > --> response.setHeader("Cache-Control", > > "no-cache"); > > response.setDateHeader("Expires",0); > > > > Saludos > > Jorge Middleton > > Argentina - Mendoza > > > > -----Original Message----- > > From: Celeste Haseltine > > [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, May 17, 2001 4:50 PM > > To: [EMAIL PROTECTED] > > Subject: How to prevent IE from cacheing a JSP page > > > > > > I'm hoping someone out here has run into this > > problem, and has found a way > > to address this. I've researched this for two days, > > and have not found a > > solution. > > > > I have 2 jsp files, one that includes server side > > JavaScript to create a > > DHTML menu dynamically. In order for these two > > jsp's to work properly, I > > have to determine what JS files to "include" in the > > JSP page based off of > > the user's login, and I also do this dynamically. > > Both of these files work > > perfectly if I test my web site using Netscape, but > > not with IE. From doing > > some research, I have discovered that Netscape does > > not cache pages, and > > that I can set the expiration of a page to "0" so > > that a particular JSP is > > always recompiled, regardless of the date. But IE > > does cache pages, and > > ignores any commands to set a page's expiration to > > 0. So if I am using > > Netscape, both the JSP's are recompiled to include > > their user specific JS > > code based off of the user's login, and each user > > get his/her specific menu > > JS code. But in IE, the most recent JSP page on the > > server, inclusive of > > that page's menu specific JS code, is sent to the > > browser, regardless of > > what the user's login is. I've tried to work around > > this by using the META > > tags in my JSP files as follows: > > > > <head> > > <META HTTP-EQUIV="expires" CONTENT="0"> > > <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> > > </head> > > > > which had no effect at all on IE. I have since > > discovered that the current > > version of IE ignores MetaTags. So I tried to use > > the response.setHeader > > method in the jsp's as follows: > > > > <head> > > <% response.setHeader("expires","0"); > > response.setIntHeader("expires",0); > > response.setHeader("Pragma","no-cache"); > > %> > > </head> > > > > which also doesn't work. Does anyone know how to > > send IE a "message" via > > the HTTP header telling it NOT to cache a jsp page, > > and to also set the > > expiration on a particular page to "0", which means > > "page has immediate > > expiration"? Or is there a way to "set" the > > expiration of a jsp page in > > JRUN 3.1 environment (I could not find one)? I do > > want both of these JSP > > pages to be "recompiled" on the server side to > > include their menu specific > > JS, based off of the user's login. I know that I > > take a performance hit by > > doing this, but since it is only two pages out of > > 300, and it occurs as part > > of the log in process, it's a performance hit I can > > live with. And it beats > > the heck out of writing 11 different JSP's, each > > with their unique > > respective JS menu code. > > > > Any advice/insight would be appreciated. > > > > Celeste _________________________________________________________________ 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