I have an issue where I have two web pages generated from Java servlets in NetBeans 5.5.
The first of these pages requires some user input and when the page's form is submitted, this input is sent to the server. The server processes the input to generate a text file which is used by a graphing tool to plot a graph as a 'png' file.
This text file and graph are then displayed in the HTML generated for the second page using 'href's in a table.
This works perfectly well but if the user wants to alter the graph, they have to go back to page one and change the options and resubmit the form.
This is where the problem occurs; in Firefox all is well but in Internet Explorer and Opera, when they resubmit the form, page two displays the original graph rather than the changed one. A hard 'refresh' is required via F5 to force the displaying of the new text file and graph.
I have tried various of the HTML:
meta http-equiv=\"refresh\" content=\"0\">
Alternatives and forcing the second page to reload upon loading but the graph and text file still show original data.
Is there a way to force the browser to 'pick up' the new text and graph generated so that the page display is correct?
I see this more as an HTML issue rather than a servlets one hence its inclusion in this forum.
Reads like to me that is might be a cached image problem. Because a hard refresh in IE attempts to force all cache to be cleared. If the image is cached locally then it either needs to be overwritten by the server processes OR the file name needs to change. Can you append a different file name to the graphic that is showing? Like:
You might also want to check into a scheduled task on the server which forces a rewrite to be read in the browser each time a revision is done...I did something similar with an application I wrote months ago.
'If the image is cached locally then it either needs to be overwritten by the server processes OR the file name needs to change. Can you append a different file name to the graphic that is showing?'
I can change the file name but this is not the approach I would like to undertake because I want to keep image and text files (and a data file used in the process) named in the same way. However, can you clarify what you mean by 'needs to be overwritten by the server processes' and how this can be done?
For instance, once the server accepts the request for the updated data file, is there a way for your server to push the image and data file to the server or to the appropriate directory? The problem reads like the data file is not being pushed to the server, thus the file's not being read properly.
Either that or try this modification to your original code:
<meta http-equiv="refresh" content="300">
But without the files being written properly...you'll have the same problem
Are you sure you have set up your web server properly ? As I recall, HTTP should have a header called somewhat like 'last-modified' which is returned by the web server to the browser indicating when the document (png image in your case) is modified. I guess if IE received a page having a header showing the image has been modified, it won't use its cached version and there is no need to force a hard refresh.
I suggest you use some packet sniffer software (I use Ethereal but it may sound an overkill for web developer) to make sure your web server is returning proper information (HTTP header) to aid the browser to determine if a cached image should be discarded or not.