i am into web development in java. 'm using java web server2.0 as my web server . i have developed my site with servlets and jsp's .. when i try accessing a JSP or servlet..the file existing in my cache is displayed(the htm already generated my the servlets and jsp's exist in cache)..instead of going to server and fetching the file and displaying.. how to avoid this..to be very straight .. what is the equivalent of response.expires(ASP) in java servlets..?
Since the cache is on your browser you need HTTP cache control. This came up recently in the Tomcat mail list and somebody replied as follows: "In my opinion, it is a cache problem. This lines might help you. <% response.setHeader("Expires", "Mon, 26 Jul 1990 05:00:00 GMT"); // Date in the past response.setHeader("Cache-Control" ,"no-cache, must-revalidate"); // HTTP/1.1 response.setHeader("Pragma", "no-cache"); // HTTP/1.0 %> " I have not tried this but you get the idea. Your servlet or JSP has to tell your browser not to cache this page. Bill
You should note that this is a problem with AOL as AOL does not promise to honor expires or no-cache requests in their own caching (not the browser's cache but AOL's own cache). The only way to insure that AOL will not cache a page is to add a variable to the URL: /servlet/MyServlet?dummy=123
This is a common problem across many browsers the best remedy would be to put it in the HTML itself rather than the Scriptlet. put the following code in the head section of the webpage <META HTTP-EQUIV = "Pragma" CONTENT="no-cache">
Joined: May 05, 2000
The point I was trying to make is that AOL's own caching (not the browser cache) does not guarantee that it will honor a no-cache request. AOL gets so many hits for the same sites that they do their own caching rather than go back to the internet to reload a site for user B that they just sent to user A. The only way to get AOL to guarantee to reload a page is to either a) have cgi-bin/ in the URL or b) have a parameter in the URL (/servlet/MyServlet?Dummy=123)
Hello, If u r using IE5 check the settings for history. same things for netscape also... In these both browsers there is settings for session control and page visit ...check that also..it will work... Close the browser and clear the tmp dir of javawebserver then reopen the same file u will get the proper result... Ganesh