You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Wendy Smoak <ja...@wendysmoak.com> on 2005/04/01 00:18:24 UTC

Re: One click on a link -> two requests/calls to Action (?!)

From: "Dave Newton" <ne...@pingsite.com>
> Nothing immediate smacks me... Without the Action code it'll be tough.
> Is it a subclass of an uber-Action? Are you doing anything...
> interesting in a custom RequestProcessor? How is the action-mapping
> configured, what ActionForward are you returning (i.e., path through the
> Action after submission), etc.

I posted the mapping and the 'execute' and 'addContact' methods:
   http://wiki.wendysmoak.com/cgi-bin/wiki.pl?StrutsDoubleRequest

There's nothing special going on.  Definitely no custom RequestProcessor.
It's just a LookupDispatchAction that looks at 'userAction' to pick the
method.  And at the point you ask it to add a record, it  returns
mapping.getInputForward();

Thanks for looking at it.  I've stared at it for a while and I just don't
see anything that could be causing that second pass through the Action code.

Could anything other than an actual HttpRequest make the RequestProcessor
say:
   Processing a 'GET' for path '/editContact'
?

I'm going to look at all the JavaScript to see if there's something that is
somehow making a second request.  (The 2-3 second delay makes me think this
is happening as/after the page is rendered.)

-- 
Wendy Smoak


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


Re: One click on a link -> two requests/calls to Action (?!)

Posted by Wendy Smoak <ja...@wendysmoak.com>.
From: "Wendy Smoak" <ja...@wendysmoak.com>

> Thanks Nic and David for confirming that I'm not [necessarily] crazy.  I
do
> think it's the JavaScript, and will check that next.

And the answer turned out to be a Filter that called chain.doFilter(...)
twice.  JSwat (debugger) exposed the problem in a few minutes.

-- 
Wendy Smoak



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


Re: One click on a link -> two requests/calls to Action (?!)

Posted by jh...@airmail.net.
If you do a form.submit() inside a submit button's onclick handler have
the handler return false.  That will prevent a double-submit.
> From: "David G. Friedman" <hu...@ix.netcom.com>
>> I had a similar problem but I was HTML based, not Struts based:  The
>> button
>> in my form was doing a submit but it was also a submit button.  The
>> result
>> was a double submit behavior much like you've shown here.
>
> Thanks Nic and David for confirming that I'm not [necessarily] crazy.  I
> do
> think it's the JavaScript, and will check that next.  It'll probably be
> Tuesday before I get back to it though.
>
> --
> Wendy Smoak
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



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


Re: One click on a link -> two requests/calls to Action (?!)

Posted by Wendy Smoak <ja...@wendysmoak.com>.
From: "David G. Friedman" <hu...@ix.netcom.com>
> I had a similar problem but I was HTML based, not Struts based:  The 
> button
> in my form was doing a submit but it was also a submit button.  The result
> was a double submit behavior much like you've shown here.

Thanks Nic and David for confirming that I'm not [necessarily] crazy.  I do 
think it's the JavaScript, and will check that next.  It'll probably be 
Tuesday before I get back to it though.

-- 
Wendy Smoak 



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


RE: One click on a link -> two requests/calls to Action (?!)

Posted by "David G. Friedman" <hu...@ix.netcom.com>.
Wendy,

I had a similar problem but I was HTML based, not Struts based:  The button
in my form was doing a submit but it was also a submit button.  The result
was a double submit behavior much like you've shown here.

Can you post the Javascript attached to your <form .... > rendered HTML tag
PLUS any for relevant buttons you click on in your end-result-HTML page?

Regards,
David

-----Original Message-----
From: Nic Werner [mailto:werner@sonoma.edu]
Sent: Thursday, March 31, 2005 5:43 PM
To: Struts Users Mailing List
Subject: Re: One click on a link -> two requests/calls to Action (?!)


Wendy,
    I had a similiar issue where I was adding a user, and I would get an
error about breaking unique constraints. Looking at the logs, I saw this
action being performed twice. I don't have an exact solution, but what I
did was re-checked my pageflow (I was using DispatchAction), and made
sure I was returning to the correct page, or none at all to narrown down
the issue. This 'solution' didn't really justify my actions to correct
it, but I haven't had time to go back.

HTH,

- Nic.


Wendy Smoak wrote:

>From: "Dave Newton" <ne...@pingsite.com>
>
>
>>Nothing immediate smacks me... Without the Action code it'll be tough.
>>Is it a subclass of an uber-Action? Are you doing anything...
>>interesting in a custom RequestProcessor? How is the action-mapping
>>configured, what ActionForward are you returning (i.e., path through the
>>Action after submission), etc.
>>
>>
>
>I posted the mapping and the 'execute' and 'addContact' methods:
>   http://wiki.wendysmoak.com/cgi-bin/wiki.pl?StrutsDoubleRequest
>
>There's nothing special going on.  Definitely no custom RequestProcessor.
>It's just a LookupDispatchAction that looks at 'userAction' to pick the
>method.  And at the point you ask it to add a record, it  returns
>mapping.getInputForward();
>
>Thanks for looking at it.  I've stared at it for a while and I just don't
>see anything that could be causing that second pass through the Action
code.
>
>Could anything other than an actual HttpRequest make the RequestProcessor
>say:
>   Processing a 'GET' for path '/editContact'
>?
>
>I'm going to look at all the JavaScript to see if there's something that is
>somehow making a second request.  (The 2-3 second delay makes me think this
>is happening as/after the page is rendered.)
>
>
>


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


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


Re: One click on a link -> two requests/calls to Action (?!)

Posted by Nic Werner <we...@sonoma.edu>.
Wendy,
    I had a similiar issue where I was adding a user, and I would get an 
error about breaking unique constraints. Looking at the logs, I saw this 
action being performed twice. I don't have an exact solution, but what I 
did was re-checked my pageflow (I was using DispatchAction), and made 
sure I was returning to the correct page, or none at all to narrown down 
the issue. This 'solution' didn't really justify my actions to correct 
it, but I haven't had time to go back.

HTH,

- Nic.


Wendy Smoak wrote:

>From: "Dave Newton" <ne...@pingsite.com>
>  
>
>>Nothing immediate smacks me... Without the Action code it'll be tough.
>>Is it a subclass of an uber-Action? Are you doing anything...
>>interesting in a custom RequestProcessor? How is the action-mapping
>>configured, what ActionForward are you returning (i.e., path through the
>>Action after submission), etc.
>>    
>>
>
>I posted the mapping and the 'execute' and 'addContact' methods:
>   http://wiki.wendysmoak.com/cgi-bin/wiki.pl?StrutsDoubleRequest
>
>There's nothing special going on.  Definitely no custom RequestProcessor.
>It's just a LookupDispatchAction that looks at 'userAction' to pick the
>method.  And at the point you ask it to add a record, it  returns
>mapping.getInputForward();
>
>Thanks for looking at it.  I've stared at it for a while and I just don't
>see anything that could be causing that second pass through the Action code.
>
>Could anything other than an actual HttpRequest make the RequestProcessor
>say:
>   Processing a 'GET' for path '/editContact'
>?
>
>I'm going to look at all the JavaScript to see if there's something that is
>somehow making a second request.  (The 2-3 second delay makes me think this
>is happening as/after the page is rendered.)
>
>  
>


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