www.webdeveloper.com
Results 1 to 5 of 5

Thread: Forcing a reload of a web page with dynamic links

  1. #1
    Join Date
    Jul 2007
    Posts
    11

    Forcing a reload of a web page with dynamic links

    Hello

    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.

    Thanks

    Martin O'Shea.

  2. #2
    Join Date
    Nov 2006
    Location
    Springfield, MO
    Posts
    1,541
    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:

    mygraphic_new_revised_DATESTAMPHERE.png

    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.

  3. #3
    Join Date
    Jul 2007
    Posts
    11

    Forcing a reload of a web page with dynamic links

    ryanbutler

    Thanks for an extremely fast answer.

    But one thing puzzles me:

    '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?

    This sounds like a better approach.

    Thanks

    Martin O'Shea.

  4. #4
    Join Date
    Nov 2006
    Location
    Springfield, MO
    Posts
    1,541
    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:

    Code:
    <meta http-equiv="refresh" content="300">
    But without the files being written properly...you'll have the same problem

  5. #5
    Join Date
    Jul 2007
    Posts
    2
    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles