1

I have a struts2, Hibernate and Spring application. It works properly at our local end. When we deploy the application on the development server sometimes some forms are submitted twice on form submission. This is causing duplicate data to be entered in the database.

This is happening only on server. This is happening rarely on Firefox but very frequently in IE. And again this happens on only some forms and not on other forms. There is nothing to differentiate those forms though.

We have sometimes used struts 2 submit button to submit forms and sometimes used java script with simple buttons to submit the form.

As a last way we can use interceptor to prevent double forms submission (We will have to make changes to lot of forms) but the point is its not happening at local end at all. Why its happening on server only and that too on some forms and sometimes only.

EDIT:

The other thing I noticed is that when I use no network proxy then even on server form is not submitted twice but when a network proxy is used, the form is submitted twice. The app works fine without any proxy properly. No duplicates at all.

What proxies has to do with it? Has anyone encountered any such issues with network proxy and double form submission?

EDIT2:

Just now I have found out that while using proxy sometimes access is denied in that case post request is sent twice by the browser resulting in double form submission.

If I see the http header I can see two post requests with one of them having following in headers

HTTP/1.1 407 Proxy Authentication Required ( The ISA Server requires authorization to fulfill the the request. Access to the Web Proxy service is denied. )

Any ideas about this? Please help.

ajm
  • 12,863
  • 58
  • 163
  • 234
  • Have you set **[Token Interceptor](http://struts.apache.org/2.2.1/docs/token-interceptor.html)** (prevents duplicate form submission) – lschin May 31 '11 at 05:41
  • @lschin No. I have not done that. That is something I will use at last if I don't get any other solution. But the problem is not double forms being submitted its something else. Don't know what. – ajm May 31 '11 at 05:50
  • Hey please come on there are so many gurus and experts on SO. I have been trying very hard on this but with no success. – ajm May 31 '11 at 07:56
  • Did you tried set `meta header`, e.g. : ``, ``, `` – lschin May 31 '11 at 08:28
  • @lschin. Hi. Thanks for the reply. I have those meta tags in my layout page. – ajm May 31 '11 at 08:31

1 Answers1

0

If you use jsp and use

<html:submit .... onClick="some javascript code">

you might try to use

<html:button .... onClick=:some javascript code" >

The condition happened to me was

  1. I use "form" tag in my jsp page
  2. I use additional button inside the form tag, which is using javascript that submit the form

Hope it would help.

exiter2000
  • 548
  • 5
  • 14