wood burning stoves 2.0*
The moose likes Servlets and the fly likes How to avoid caching of JSP pages ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "How to avoid caching of JSP pages ?" Watch "How to avoid caching of JSP pages ?" New topic
Author

How to avoid caching of JSP pages ?

Raghav Sam
Ranch Hand

Joined: Apr 12, 2001
Posts: 412
I am running an application on Tomcat 3.2.1 over a LAN. The problem is every time I make a change to a JSP page, I have to do the following:
1. Clear the local cache i.e., from the Temporary Internet Files Folder.
2. Clear the 'work' folder of the Tomcat (where the compiled-JSP .java files and .class files reside) which is running on the server.
3. And restart Tomcat !
The third one is highly irritating as I have to move to the server and then restart it. How I can avoid the above 3 steps as these take a considerable time out of my development work ? Any suggestions ?
------------------
Raghav.


Be who you are and say what you feel, because those who mind don't matter and those who matter don't mind.<br />- Dr. Seuss
anup vachali
Ranch Hand

Joined: Oct 17, 2000
Posts: 54
Raghav,
Try puttin in these tags in ur page.
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
Let me know if that helped.
Anup
Steve Snodgrass
Greenhorn

Joined: Jun 12, 2001
Posts: 27
<% response.setDateHeader("Expires", 0);
response.setHeader("Pragma", "no-cache");
if (request.getProtocol().equals("HTTP/1.1")){
response.setHeader("Cache-Control", "no-cache");
}%>
Raghav Sam
Ranch Hand

Joined: Apr 12, 2001
Posts: 412
both of the above didnt work
Manohar Karamballi
Ranch Hand

Joined: Jul 17, 2001
Posts: 227
Try this...
<META HTTP-EQUIV=Expires CONTENT=Fri, Jun 12 1981 08:20:00 GMT>
<META HTTP-EQUIV=Pragma CONTENT=no-cache>
<META HTTP-EQUIV=Cache-Control CONTENT=no-cache>
Place this in Head Tag...
Let me know whether it worked or not...
Eric Klotzko
Greenhorn

Joined: Aug 10, 2001
Posts: 3
Actually, you should use all 4 of the following:
<META HTTP-EQUIV="Expires" CONTENT="0">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-store">
Hope that this helps.
Eric
vivek sivakumar
Ranch Hand

Joined: Aug 09, 2001
Posts: 187
eric ur way does not seem to work for me!!!


SCJP, SCWD <br />A farmer learns more from a bad harvest than a good one.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16094
    
  21

All of the above have to do with caching the pages on the CLIENT. If you're having problems where you want JSP changes to "take" then you have to not only ensure that the client requests an http reload, but the server has to detect that the page source code has changed and recompile it.
There are options in the tomcat server.xml to control this process. Also, try searching this newsgroup for other messages posted on the subject - it's not an uncommon problem.


Customer surveys are for companies who didn't pay proper attention to begin with.
Eric Klotzko
Greenhorn

Joined: Aug 10, 2001
Posts: 3
Tim is absolutely correct.
Shame on me for not reading your items
more carefully. New compilation of JSPs
was not what I was referring to.
FYI, when I'm running IBM WebSphere 3.5 on
NT, I have to bounce the server every time
my beans or servlets are compiled to reflect
changes (but not JSPs).. However, this is not
the case when I'm running WebSphere on the
IBM OS/390 mainframe... perhaps platform plays
a role.. ?
Good hunting.. please post a resolution should you
find one.
Eric
Raghav Sam
Ranch Hand

Joined: Apr 12, 2001
Posts: 412
The context tag in the server.xml file has the reloadble attribute set to true. What else do I need to do ?
I was searching this forum for related topics when i found the following topic:
Refreshing JSP and servlet in TOMCAT3.2 posted on July 12, 2001 with the same problem, but with no solution.
Seems some problem with Tomcat 3.2.1?

------------------
Raghav.
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

I'm using Tomcat 3.2.1 under WinNTSP6, and have no problems with this. Tomcat can tell when I make the smallest change, and will recompile.

But even if this doesn't work for a particular user, Tomcat restarts happen in seconds. This is not a mountain.

Now don't get me started about iPlanet...
 
GeeCON Prague 2014
 
subject: How to avoid caching of JSP pages ?