You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jeremiah Johnson <jo...@egr.msu.edu> on 2005/08/02 23:44:59 UTC

action executing two times

I have an action mapping that looks like:
   <action
	attribute="someForm"
	name="someForm"
	path="/my/path"
	scope="request"
          validate="false"
          parameter="cmd"
	type="someAction">
    <forward
	name="showForm"
	path="myTileDefinition"/>
    </action>

If I click the link to /my/path.do my action class sends out the
showForm then displays myTileDef. Then it executes the same action class
again. The second execution doesn't copy some of the information from
the first execution. My action class is a LookupDispatchAction so on the
second time it errors out because cmd is not defined as a parameter. If
I point my action at a regular jsp page with a tile definition in the
page it does the same thing. If I point the action at a plain old jsp
page it executes once. Why does this execute more then once? how do I
write code around this problem? I'm using struts 1.2.7. Thanks!
/Jeremiah

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


Re: action executing two times

Posted by Jeremiah Johnson <jo...@egr.msu.edu>.
Fount the problem. I had <img src="" /> in my tile. When I removed it it 
worked. Not sure why that causes problems. That didn't have anything to 
do with the link I was clicking. thanks
/Jeremiah


Laurie Harper wrote:
> Jeremiah Johnson wrote:
> 
>> I have an action mapping that looks like:
>>   <action
>>     attribute="someForm"
>>     name="someForm"
>>     path="/my/path"
>>     scope="request"
>>          validate="false"
>>          parameter="cmd"
>>     type="someAction">
>>    <forward
>>     name="showForm"
>>     path="myTileDefinition"/>
>>    </action>
>>
>> If I click the link to /my/path.do my action class sends out the
>> showForm then displays myTileDef. Then it executes the same action class
>> again. The second execution doesn't copy some of the information from
>> the first execution. My action class is a LookupDispatchAction so on the
>> second time it errors out because cmd is not defined as a parameter. If
>> I point my action at a regular jsp page with a tile definition in the
>> page it does the same thing. If I point the action at a plain old jsp
>> page it executes once. Why does this execute more then once? how do I
>> write code around this problem? I'm using struts 1.2.7. Thanks!
>> /Jeremiah
> 
> 
> How are you invoking the action (from an HTML link? form submission? 
> directly by typing the URL into the address bar?); is there any 
> Javascript involved?
> 
> Does the response contain any suspect hrefs (for example <img/> tags 
> with src="#") that might be triggering the second request?
> 
> Using something like tcpflow to watch what's going over the wire can 
> help figure out where your 'mystery' request is coming from.
> 
> If that doesn't help, I'd suggest posting any HTML that invokes the 
> action as well as the HTML it produces as a resonse.
> 
> L.
> 

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


Re: action executing two times

Posted by Jeremiah Johnson <jo...@egr.msu.edu>.
I think this has me on the right track. I was using firefox. I tried 
this with ie and it works fine. I'm clicking on a link that is an 
<html:link> to cause this. If I type the url the same thing happens. 
There is javascript  code that submits the page by clicking on a link 
but it's not tied to the link I am clicking. there are some links where 
href=# but they are not created by struts tags. How does src="#" trigger 
another submit? I'm going to start taking html out of the page till I 
figure out which piece causes this. I post back if I find anything 
interesting. Thanks!
/Jeremiah


Laurie Harper wrote:
> Jeremiah Johnson wrote:
> 
>> I have an action mapping that looks like:
>>   <action
>>     attribute="someForm"
>>     name="someForm"
>>     path="/my/path"
>>     scope="request"
>>          validate="false"
>>          parameter="cmd"
>>     type="someAction">
>>    <forward
>>     name="showForm"
>>     path="myTileDefinition"/>
>>    </action>
>>
>> If I click the link to /my/path.do my action class sends out the
>> showForm then displays myTileDef. Then it executes the same action class
>> again. The second execution doesn't copy some of the information from
>> the first execution. My action class is a LookupDispatchAction so on the
>> second time it errors out because cmd is not defined as a parameter. If
>> I point my action at a regular jsp page with a tile definition in the
>> page it does the same thing. If I point the action at a plain old jsp
>> page it executes once. Why does this execute more then once? how do I
>> write code around this problem? I'm using struts 1.2.7. Thanks!
>> /Jeremiah
> 
> 
> How are you invoking the action (from an HTML link? form submission? 
> directly by typing the URL into the address bar?); is there any 
> Javascript involved?
> 
> Does the response contain any suspect hrefs (for example <img/> tags 
> with src="#") that might be triggering the second request?
> 
> Using something like tcpflow to watch what's going over the wire can 
> help figure out where your 'mystery' request is coming from.
> 
> If that doesn't help, I'd suggest posting any HTML that invokes the 
> action as well as the HTML it produces as a resonse.
> 
> L.
> 

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


Re: action executing two times

Posted by Laurie Harper <la...@holoweb.net>.
Jeremiah Johnson wrote:

> I have an action mapping that looks like:
>   <action
>     attribute="someForm"
>     name="someForm"
>     path="/my/path"
>     scope="request"
>          validate="false"
>          parameter="cmd"
>     type="someAction">
>    <forward
>     name="showForm"
>     path="myTileDefinition"/>
>    </action>
> 
> If I click the link to /my/path.do my action class sends out the
> showForm then displays myTileDef. Then it executes the same action class
> again. The second execution doesn't copy some of the information from
> the first execution. My action class is a LookupDispatchAction so on the
> second time it errors out because cmd is not defined as a parameter. If
> I point my action at a regular jsp page with a tile definition in the
> page it does the same thing. If I point the action at a plain old jsp
> page it executes once. Why does this execute more then once? how do I
> write code around this problem? I'm using struts 1.2.7. Thanks!
> /Jeremiah

How are you invoking the action (from an HTML link? form submission? 
directly by typing the URL into the address bar?); is there any Javascript 
involved?

Does the response contain any suspect hrefs (for example <img/> tags with 
src="#") that might be triggering the second request?

Using something like tcpflow to watch what's going over the wire can help 
figure out where your 'mystery' request is coming from.

If that doesn't help, I'd suggest posting any HTML that invokes the action 
as well as the HTML it produces as a resonse.

L.

-- 
Laurie, Open Source advocate, Java geek and novice blogger:
http://www.holoweb.net/laurie


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