Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What causes duplicate requests to occur using spring,tomcat and hibernate

I'm working on a project in Java using the spring framework, hibernate and tomcat.

Background: I have a form page which takes data, validates, processes it and ultimately persists the data using hibernate. In processing the data I do some special command (model) manipulation prior to persisting using hibernate.

Problem: For some reason my onSubmit method is being called twice, the first time through things are processed properly. However the second time through they are not; and the incorrect information is being persisted.

I've also noticed that on other pages which are simply pulling information from the data base and displaying on screen; Double requests are happening there too.

Is there something misconfigured, am I not using spring properly..any help on this would be great!

Additional Information:

The app is still being developed. In testing the app I'm running into this problem. I'm using the app as I would expect it to be used (single clicks,valid data,etc...)

like image 977
IaCoder Avatar asked Oct 28 '08 18:10

IaCoder


1 Answers

If you are testing in IE, make note that in some versions of IE it sometimes submits two requests. What browsers are you testing the app in?

There is the javascript issue, if an on click handler is associated with submit button and calls submit() and does not return false to cancel the event bubble.

like image 104
Josh Avatar answered Sep 29 '22 02:09

Josh