You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Pierre Goupil <go...@gmail.com> on 2006/12/19 22:55:05 UTC

avoiding multiple form submission

Hello, listers !

As you have certainly seen it, some sites submit their forms as many times
as you validate them. For instance, how many forums post two messages if, by
mistake, you click on the submit button twice ?

As everyone (I guess), I had to face this problem, and then... I gave
Hibernate a try : then, for some reason, it didn't happened to my webapp
anymore. Great, thought I !

But today, in front of my customers for a demo (!), I decided not to use
Firefox as usual, but Konqueror (a Linux browser). And to show them, I
validated a form 5-6 times and... it got submited twice. 'f*?*?' thought I !
'Not now...' :-/

If anyone could explain me this behaviour, it would be appreciated : why an
Hibernate can avoid this on a Firefox, but partly not on another browser !

But if I post it here is because my REAL question is this one : does anyone
know a way to totally avoid this ? I guess this is servlet container (hence
Tomcat, for me) - related.

Any suggestions ?

Regards,


Pierre

-- 
To her who remembers every word spoken,
>From the heroe's oath
To the baby's cry.
You're my eternal witness.

Re: avoiding multiple form submission

Posted by Pierre Goupil <go...@gmail.com>.
Hello !

2006/12/20, olivier nouguier <ol...@gmail.com>:
>
> 1) How do you submit your forms ... a few years ago I had a guy who show
> my
> that "issue", in fact he submitted the form "oncheck" on an input image
> ...


No, just <html:form> and <hmtl:submit>



2a) There is a simple server side pattern two avoid double submit:(could not
> find the www reference).
> * jsp put a token in the session (scriplet, taglib).
> * submit action test the token and remove it from the session.
> so the second post can safely fail as the token is not found !


Ok, thanx ! I've found a description in this page :

http://www.jax-magazine.com/itr/online_artikel/psecom,id,648,nodeid,147.html

look for "Handle duplicate form submission"


Thanx again & regards,

Pierre




**
>
> On 12/19/06, Pierre Goupil <go...@gmail.com> wrote:
> >
> > Hello, listers !
> >
> > As you have certainly seen it, some sites submit their forms as many
> times
> > as you validate them. For instance, how many forums post two messages
> if,
> > by
> > mistake, you click on the submit button twice ?
> >
> > As everyone (I guess), I had to face this problem, and then... I gave
> > Hibernate a try : then, for some reason, it didn't happened to my webapp
> > anymore. Great, thought I !
> >
> > But today, in front of my customers for a demo (!), I decided not to use
> > Firefox as usual, but Konqueror (a Linux browser). And to show them, I
> > validated a form 5-6 times and... it got submited twice. 'f*?*?' thought
> I
> > !
> > 'Not now...' :-/
> >
> > If anyone could explain me this behaviour, it would be appreciated : why
> > an
> > Hibernate can avoid this on a Firefox, but partly not on another browser
> !
> >
> > But if I post it here is because my REAL question is this one : does
> > anyone
> > know a way to totally avoid this ? I guess this is servlet container
> > (hence
> > Tomcat, for me) - related.
> >
> > Any suggestions ?
> >
> > Regards,
> >
> >
> > Pierre
> >
> > --
> > To her who remembers every word spoken,
> > From the heroe's oath
> > To the baby's cry.
> > You're my eternal witness.
> >
> >
>
>
> --
> "Souviens-toi qu'au moment de ta naissance tout le monde était dans la
> joie
> et toi dans les pleurs.
> Vis de manière qu'au moment de ta mort, tout le monde soit dans les pleurs
> et toi dans la joie."
>
>


-- 
To her who remembers every word spoken,
From the heroe's oath
To the baby's cry.
You're my eternal witness.

Re: avoiding multiple form submission

Posted by olivier nouguier <ol...@gmail.com>.
1) How do you submit your forms ... a few years ago I had a guy who show my
that "issue", in fact he submitted the form "oncheck" on an input image ...

2a) There is a simple server side pattern two avoid double submit:(could not
find the www reference).
* jsp put a token in the session (scriplet, taglib).
* submit action test the token and remove it from the session.
so the second post can safely fail as the token is not found !

2b) js code !?

On 12/19/06, Pierre Goupil <go...@gmail.com> wrote:
>
> Hello, listers !
>
> As you have certainly seen it, some sites submit their forms as many times
> as you validate them. For instance, how many forums post two messages if,
> by
> mistake, you click on the submit button twice ?
>
> As everyone (I guess), I had to face this problem, and then... I gave
> Hibernate a try : then, for some reason, it didn't happened to my webapp
> anymore. Great, thought I !
>
> But today, in front of my customers for a demo (!), I decided not to use
> Firefox as usual, but Konqueror (a Linux browser). And to show them, I
> validated a form 5-6 times and... it got submited twice. 'f*?*?' thought I
> !
> 'Not now...' :-/
>
> If anyone could explain me this behaviour, it would be appreciated : why
> an
> Hibernate can avoid this on a Firefox, but partly not on another browser !
>
> But if I post it here is because my REAL question is this one : does
> anyone
> know a way to totally avoid this ? I guess this is servlet container
> (hence
> Tomcat, for me) - related.
>
> Any suggestions ?
>
> Regards,
>
>
> Pierre
>
> --
> To her who remembers every word spoken,
> From the heroe's oath
> To the baby's cry.
> You're my eternal witness.
>
>


-- 
"Souviens-toi qu'au moment de ta naissance tout le monde était dans la joie
et toi dans les pleurs.
Vis de manière qu'au moment de ta mort, tout le monde soit dans les pleurs
et toi dans la joie."