self.endResponse() simply stops output; it doesn't send a redirect message to the browser.
You want "self.sendRedirectAndEnd()" which you pass an url. It will stop output *and* tell the browser to move along.
Another note: the "working flag" may only exist in one thread in webkit; if you have enough concurrency happening, that flag may not exist in other instances of your servlet; it's probably likely that a client will get the same instance often, but I don't think it's guaranteed. Perhaps moving your working flag into your database wrapper or some such is better.
I watched a client use a CMS that we're working on yesterday. He did the same thing you're describing: I watched as he said "wait; what was that?" and went back and re-submitted the same input 3 times in about 10 seconds. It doesn't corrupt our database, but it sure fills it with junk. We can't rely on a flag, though, because it only takes a blip to store the data; there's no concurrency problem, just redundancy. Blah.
There's probably a way to "cache" an input chunk in session, and not to process similar chunks if it was seen in the last "n" seconds. I've got to think about that.
David London wrote:
I'm running into what I'm told is a common problem, so I'm hoping that someone out there has a common solution.
My users are submitting the page multiple times.
Based on the user input and the state my code does a number of calculations. If I get the same input multiple times the data can become corrupted, which, of course, is a bad situation.
I did see a post previously that dealt with database access, but since I'm doing more than just that (and I have the pleasure of working with oracle) I was trying for a 'better' solution. I had already known that I couldn't rely upon javascript to solve my problem.
What I was thinking, is that since all of my calculations are done within the awake method of a single class (and then a particular page is chosen to forward to), I could just have a 'working' flag set and released in the awake method (and stored in the session) of this controller class. Setting and testing the flag works fine, but I am lacking some vital piece of knowledge because I now get blank pages. This is probably due to my calling self.endResponse() if the controller class receives a response while it is still processing.
I'm hoping that by now someone has a good idea of what the problem and solution is.
Is the solution something as simple storing the first response/transaction and then replacing the last response with the old one? Or am I going in the wrong direction?
I am really hoping that someone has a solution because I know that telling the users to 'only click once' is not going to work.
David London [EMAIL PROTECTED]
------------------------------------------------------- This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek For a limited time only, get FREE Ground shipping on all orders of $35 or more. Hurry up and shop folks, this offer expires April 30th! http://www.thinkgeek.com/freeshipping/?cpg=12297 _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss
------------------------------------------------------- This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek For a limited time only, get FREE Ground shipping on all orders of $35 or more. Hurry up and shop folks, this offer expires April 30th! http://www.thinkgeek.com/freeshipping/?cpg=12297 _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss
