This is certainly not an easy thing to do, you could try to use JavaScript to continuously generate requests to the server every 5 seconds until the results are ready and then they are returned instead of the "waiting" screen. Then you would have to tell the servlet to expect requests every 5 (maybe a little more to allow for synchronization issues) seconds and when it doesn't get one to act on this fact by shutting down the process.
When you see the airline sites where they are validating Visa card numbers in real time and they simply put up a page which says "Please allow up to 60seconds for this process to complete. Do not hit back, stop or refresh until this process completes" you can tell that any kind of detection is tricky because if it wasn't they'd implement it. What we have done on our company's site where we poll servers around the world for delay times we return an intermediary page which in turn calls the results page. This intermediary page has the "Please wait..." message on it. One useful tip I can give you is that when we tried to put an animated GIF on this page to keep the customer focused, it failed because the page did an immediate request and the GIF stopped as soon as the request went out. What does work though is a small flash animation which keeps running even though another page has been requested. Anyway that's my 2c worth, hope you can take something from it. Later, Andoni. ----- Original Message ----- From: "Les Parkin" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, September 13, 2004 10:51 AM Subject: Detecting The Stop Button > Hi, > > I am working on an application that allows users to run database queries > from a web browser (we are currently using Tomcat 5.0.25). A problem > arises when a user starts a new query and then decides that they want to > cancel it by hitting the browser "stop" button. After a lot of reading > on this already, I appreciate that it is not possible for Tomcat to be > notified that this has occurred, since no event is generated by the > browser that Tomcat can detect. The solution I attempted was to start a > background "pinger" thread in Tomcat which periodically writes back to > the browser as the query is running. The theory was that if the user > hits the "stop" button then I would get an IOException since the socket > connection has been broken. In practice this does not happen, the pinger > thread continues to write output without any exception or error > occurring, and it is as if this output is being lost in a black hole > somewhere! (the browser does not receive any more output after the stop > button has been pressed, as expected). > Has anybody got any suggestions as to how I can get this to work, or a > more general approach to solving the "stop" button problem? > > Many Thanks! > Les. > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
