This problem is confusing me for a period of time. It is primarily about the double submit problem.
The scenario is like the following: My web app has a page that list all the report(in html button) the user can click. After the button is clicked, another window will pop out. In the popped out window, the user can choose the report's date range. After that, the user clicks the submit button in the popped out window, then the request is processed and an excel report is generated.
I use struts and iBatis in this web app. So the flow of report processing is: choose date range -> to ActionForm -> forward to the HttpServlet and process and output the xls report.
And here is the problem.
The window that let the user choose date range is still on the screen after the date is choosed and submitted. By this time, if the user click the submit button(in date choosing window) many times, the request will also be sent multiple times. Thus the content of the report generated will simply be wrong.
So, what should I do to prevent the user from double(or even more) submit? Or, how do I tell the server to just ignore the second request if the first request is still in processing.
I tried Strut's TokenProcessor. But it seems not suitable for my problem. Yes, I can ask the server to forward to different page after receiving the second request, the report will still be processed, but will be discarded afterwards(because the app forwards the second request to another page). And it would just throw a "connection reset by peer" exception.
Any suggestion or advice is welcomed and appreciated. Thank you.