I would like to create a page that has a "waiting" or "loading" animated gif that is displayed while a report is being generated. Similar to what Priceline or Expedia do when they are trying to find a flight for you.
I've tried using iframes. When I first experimented with an iframe going to a static page, the behaviour worked as expected. However, once I started going to dynamic content, i.e. servlet/JSP, my "waiting" image stayed on the page along w/ the report.
How do display the image and when the processing is complete, display my report in a new page without the image on the page? I'm sure this is covered in some FAQ or site, but have been unsuccessful in locating any info. I'd appreciate any help on this.
Even though everyone (here) hates META refreshes, it would do the job.
Instead of having the form post directly to the script that is processing the request, have it post to another page. Design that page to look like the "please wait" but do a META REFRESH in that other page to the URL you were originally posting to with their form data in the querystring.
Then just modify your original posturl (if necessary) to request from the querystring instead of the form.
WeirdoPL did a better job asking the question than I did:
I think the question is: how to display an animated gif WHILE the process is running and how to make it dissapear after it's finished it's tasks...
That is exactly what I want to do.
To make things complicated, the script (a struts servlet) I'm calling returns a PDF in the form of a byte stream so the browser usually handles the mime type.
Maybe the way priceline and others do it is that the resulting page (the page that is processed) manipulates the surrounding objects (animated gif, text, etc), e.g. hides them. I'd think there would be some kind of pattern on doing this sort of thing.
Have it request the same URL twice (with meta-refresh).
If the visitor hits it the first time, display the waiting page, start the processing, and set some attribute in the session.
If the request comes in again (has that attribute set), then check that session attribute - if the corresponding report is ready then display the report, if not - then display the same waiting page again.