Here's one technique to detect refreshes of an operation: 1) When the JSP page is executing, generate a unique token value 2) Add it as a hidden control to the form whose submission triggers the operation 3) Add it to the session as well 4) When the form's action is submitted, check that the hidden value matches that on the session and refuse to process if not 5) Remove the session token This way, the initial submission will succeed while subsequent submissions as the result of refreshes will be blocked.
If the processing takes a minute or two, I would forward the user to a "Wait Page" saying something like "Please wait while the data is being retrieved". This page would have a refresh tag that will refresh ever X seconds to see if the data is available. Once it is available, it forwards the user to the display page so he/she can see the results. Keeping the user waiting for any length of time waiting for a web page to load is only asking for them to hit refresh. I'm actually in the middle of rewriting some code I have to do exactly this. It is currently done in Struts/Tiles and works fine but sometimes hte user has to wait up to a minute for the data to be retrieved. Now, the user immediately sees a wait page and knows we're working on it. They will see the display page once it's done. If the user refreshes the wait page it's no big deal since that's what the wait page does anyway. Brian
Hope you only want it to work with IE browsers.......
Joined: Mar 31, 2003
Thanks Brian and Bear for the replys. I am a little confused about both: ( these are probably more jsp-STRUTS related) With the token issue: I am linking to a jsp report off of an applet, and lets say instead of a token I wanted to only allow a refresh after 2 minutes. In my action class that is sent the second time, how to I cancel current processing. You generally need to forward the page on all page requests? Where would I forward to? With the intermediate page: Lets say i make call to my mapper class that does that database retrieval, since that is what is taking so long... where would I make that call and still be able to forward to an intermediate page? - Thanks for all the help Eric