This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Browser won't refresh unless you hit F5 - how can I do this in code?
Eric Carlson
Greenhorn
Joined: Sep 27, 2002
Posts: 1
posted
0
Hi list! I have a simple logogenerator at http://www.java-technical.com/logogenerator. This is a servlet which creates the image then returns after displaying it. What happens in practice though is the image is always cached, so just hitting the "Generate" button on that page doesn't show anything new. I know its definitely changing from inspecting the file on the server. The annoying thing is the user can see the latest image at any time with F5. I want to reproduce this behaviour, I tried adding the usual headers in the JSP with no joy : <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> <META HTTP-EQUIV="Pragma-directive" CONTENT="no-cache"> <META HTTP-EQUIV="cache-directive" CONTENT="no-cache"> <META HTTP-EQUIV="Expires" CONTENT="Mon, 06 Jan 1990 00:00:01 GMT"> Anyone any clues please?
Med Shabe
Ranch Hand
Joined: May 08, 2001
Posts: 84
posted
0
Have you tried reloading the page with JS? window.location.reload() Med.
Jeff Black
Greenhorn
Joined: Aug 02, 2002
Posts: 14
posted
0
Something to try: Instead of generating the image and writing it to the file system: <img src='output.jpg'> have it generated by a servlet whose response type is image/gif. So in your jsp, do this: <img src="ImageServlet"> Then setting the cache controls for this response may solve your problem.
Hi, This works for me in jsp page. Try it out <% response.addHeader("Pragma","No-cache"); response.addHeader("Cache-Control","no-cache"); response.addDateHeader("Expires",1); %>
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: Browser won't refresh unless you hit F5 - how can I do this in code?