You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rafael Taboada <ka...@gmail.com> on 2006/01/07 02:41:07 UTC

double submit problem

Hi folks... I'm trying to solve my problem when an user submit a form and he
clicks the submit button more than twice.

My app runs perfect... I mean, It saves data. But in this case, it saves
data as many clicks the user does.

Do u know how I can solve that?

I'm trying to use Struts Dialog:
http://struts.sourceforge.net/strutsdialogs/dialogaction.html

I implemented an app using that but it still has the same problem... why?
maybe I'm doing something wrong??? I followed the login sample. But in my
case I have a NewData module.

thanks in advance...

--
Rafael Taboada
Software Engineer

Cell : +511-97753290

"No creo en el destino pues no me gusta tener la idea de controlar mi vida"

Re: double submit problem

Posted by Ted Husted <te...@gmail.com>.
I can't speak to Struts Dialog, but in a typical Struts application
you can guard against double submits by calling

        saveToken(request);

in the "prepare" action that displays the form for editing. In the
"process" action that handles the save, check

        boolean tokenValid = isTokenValid(request);
        isTokenValid(request)

to see if a double submnit happened.

-- HTH, Ted.
http://www.husted.com/poe/

On 1/6/06, Rafael Taboada <ka...@gmail.com> wrote:
> Hi folks... I'm trying to solve my problem when an user submit a form and he
> clicks the submit button more than twice.
>
> My app runs perfect... I mean, It saves data. But in this case, it saves
> data as many clicks the user does.
>
> Do u know how I can solve that?
>
> I'm trying to use Struts Dialog:
> http://struts.sourceforge.net/strutsdialogs/dialogaction.html
>
> I implemented an app using that but it still has the same problem... why?
> maybe I'm doing something wrong??? I followed the login sample. But in my
> case I have a NewData module.
>
> thanks in advance...
>
> --
> Rafael Taboada
> Software Engineer
>
> Cell : +511-97753290
>
> "No creo en el destino pues no me gusta tener la idea de controlar mi vida"
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: double submit problem

Posted by Rick R <st...@reumann.net>.
Rafael Taboada wrote:
> Thanks for ur replies... I'm interested in tokens method
> 
> Please, do u know a site where I can find more information about this???

I have an example and lesson here on it:
http://www.learntechnology.net/struts-token.do

-- 
Rick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: double submit problem

Posted by Rafael Taboada <ka...@gmail.com>.
Thanks for ur replies... I'm interested in tokens method

Please, do u know a site where I can find more information about this???

thanks

--
Rafael Taboada
Software Engineer

Cell : +511-97753290

"No creo en el destino pues no me gusta tener la idea de controlar mi vida"

Re: double submit problem

Posted by Michael Jouravlev <jm...@gmail.com>.
On 1/6/06, Rafael Taboada <ka...@gmail.com> wrote:
> Hi folks... I'm trying to solve my problem when an user submit a form and he
> clicks the submit button more than twice.
>
> My app runs perfect... I mean, It saves data. But in this case, it saves
> data as many clicks the user does.
>
> Do u know how I can solve that?
>
> I'm trying to use Struts Dialog:
> http://struts.sourceforge.net/strutsdialogs/dialogaction.html
>
> I implemented an app using that but it still has the same problem... why?
> maybe I'm doing something wrong??? I followed the login sample. But in my
> case I have a NewData module.

Struts Dialogs does not help to avoid *explicit* resubmits when you go
back and hit submit button again. It helps to fight *implicit*
resubmits when a user hits "Refresh" button to refload a page.

The Login Dialog sample is built in a way that you cannot hit Back
button and get to login form, because Login Dialog is stateful and
renders non-cachable content. Therefore after you log in and click
Back, you will see Logout page, not Login page.

Even if you use browser like Opera and you was able to submit the same
content again, it is up to the data model to recognise this and either
to allow it or to forbid it.

Struts Dialogs assumes that web resources are stateful and render
themselves according to their state. It does not contain any means
like tokens to prevent double submit if your data model and rendering
approach allows so.

Michael.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org