开发者

Forms submitting twice in Struts 2, Hibernate application behing a network proxy

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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜