struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank W. Zammetti" <fzli...@omnytex.com>
Subject Re: Double Execution of Struts Actions
Date Fri, 08 Sep 2006 23:02:23 GMT
I suspect you might not have understood it all, otherwise you wouldn't 
still be calling it a bug... have a look here:

http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/properties/background_2.asp

(forgive me for referencing an MS resource, but it was the first I 
found).  Not that the value of the background attribute is a URL... What 
Laurie is saying is that the value # is interpreted as meaning the 
current page... so, let's follow the bouncing ball:

(1) User submits form on page A  to URL pageA.do
(2) Action A executes and forwards to JSP B
(3) JSP B contains <td background="#336699">, which is interpreted as 
<td background="#">, because its supposed to be a URL, the browser does 
the best it can, which means it sees the hash mark and assumes you meant 
the current page, the color value just gets ignores...
(4) The browser basically expands that <td> to <td 
background="/pageA.do">, which results in a GET request for /pageA.do, 
which is of course Action A.
(5) Action A executes, hence your "double-submit".

The only part that stumps me a little is if you saw two *identical* 
requests, because I would expect the second one to not have any 
parameters, unless you used GET to submit the form, then it may get 
stored in history and used the second time, I'm not certain... but if it 
was a form submission, it was likely POST'd, so I'm not completely sure 
there.

Does that make sense?  This isn't a Struts bug, as Laurie corrently 
states, it's just a common HTML coding error.  If you were submitting to 
plain servlets, you would have seen your servlet execute twice.  If it 
was a CGI to a C program, the program would have executed twice, Struts 
has nothing to do with it.

Frank

Daniel Chacón Sánchez wrote:
> I understand all that, but It not have to happen, fot me its a bug, because
> the action don´t have to be call twice, no matter that the property of the
> td was wrong
> 
> 2006/9/9, Laurie Harper <laurie@holoweb.net>:
>>
>> That's not a Struts bug, it's a common HTML coding error. IIRC, the
>> 'background' property of a TD specifies the URL of an image to place as
>> the background, not a colour; at least, that appears to be what's
>> happening here.
>>
>> As with <img src="#"/>, the image URL is being interpreted as the
>> current page, so when the browser sees that TD, it tries to use the
>> current page URL to load the background image -- hence, hitting the
>> action again.
>>
>> L.
>>
>> Daniel Chacón Sánchez wrote:
>> > O MY GOD!!!!!!!!!!!!!!!!!!!!!!
>> >
>> > This was the mistake: <td background="#336699"> and the td doe´s not
>> have a
>> > background!!!!!!!!!!!!!!!
>> >
>> > How can it be posible!!! The double submit problem is for html
>> problems!!!
>> > You will ask how I can discover this.... yes... I cut all the code and
>> put
>> > ir step by step again since I found the problem!!!
>> >
>> > When I read this on a mail list:
>> >
>> >
>> > Santhi,
>> > I have found the mistake. I had a # in a table-tag.*<table
>> background="#">*
>> >   ...
>> > </table>
>> > I don't know, why struts execute an action twice, but I'm happy. ;o))
>> > Thanks for your help.
>> > Frank
>> >
>> > In my mind I say to me that´s not possible.... but yes *The double
>> submit
>> > problem is product of HTML errors*, know I want to notify to the 
>> "struts
>> > people" about this problem how can I talk to then, this is a big bug of
>> the
>> > great strtus framework.
>> >
>> > Thank you all for the help, hope this solution helps others!
>> >
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM/Yahoo: fzammetti
MSN: fzammetti@hotmail.com
Author of "Practical Ajax Projects With Java Technology"
  (2006, Apress, ISBN 1-59059-695-1)
Java Web Parts - http://javawebparts.sourceforge.net
  Supplying the wheel, so you don't have to reinvent it!

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


Mime
View raw message