If you rely on this however, you can still be assured your server will
still be broken!
Seriously. Its *not* the answer. If your using javascript to avoid
doubleclicks, because doubleclicks crash the server, then you should be
prepared to accept that the server will still crash on daily basis,
because if more then one page request is happening, you'll get precisely
the same effect.
Try this;-
from MiscUtils import DBPool
In the servlet, where you aquire the mysql connection, replace it with
something like;-
dbPool = DBPool.DBPool(MySQLdb,5, host="localhost",user="rarara",passwd="rararar",db="rarara")
db=dbPool.getConnection()
cr=db.cursor()
This *should* add a bit of thread safety to it.
I'd also use the threading lib to whack thread locks around the db
operations just for safety sake.
--
Shayne O'Neill
http://perth.indymedia.org
I know how hard it is for you to put food on your family."
----George W. Bush
On Fri, 9 Apr 2004, Tim Roberts wrote:
> On Thu, 08 Apr 2004 18:45:30 -0400, Eduardo Elgueta <eelgueta@...>
> wrote:
>
> >
> >
> >David,
> >
> >Thank you for your answer, but I'm not using that method. In fact, it's
> >a simple form that works pretty well most of the time.
> >
> >The problem is some users (don't ask me why) double-click submit
> >buttons. Usually they receive an error message (because the record was
> >already updated), but sometimes happens the problem I described.
> >
> >
>
> One good way to handle this is to include an onClick event handler for
> your button, and kill the submission if it has been clicked once already:
>
> <script>
> var submitted = 0;
> function onceOnly() {
> return submitted++ == 0;
> }
> </script>
> ...
> <input type=submit ... onClick='return onceOnly();'>
>
> You could also do it in the onSubmit event for your <form>.
>
> --
> - Tim Roberts, timr@...
> Providenza & Boekelheide, Inc.
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IBM Linux Tutorials
> Free Linux tutorial presented by Daniel Robbins, President and CEO of
> GenToo technologies. Learn everything from fundamentals to system
> administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
> _______________________________________________
> Webware-discuss mailing list
> Webware-discuss@...
> https://lists.sourceforge.net/lists/listinfo/webware-discuss
>
|