File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to avoid caching of JSP pages ?

 
Raghav Sam
Ranch Hand
Posts: 412
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
anup vachali
Ranch Hand
Posts: 54
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<% 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
Posts: 412
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
both of the above didnt work
 
Manohar Karamballi
Ranch Hand
Posts: 227
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 187
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
eric ur way does not seem to work for me!!!
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17624
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Eric Klotzko
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 412
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3695
IntelliJ IDE Java Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic