views:

656

answers:

2

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...)

A: 

Could be as simple as users clicking on a link twice, re-submitting a form while the server is still processing the first request, or hitting refresh on a POST-ed page.

Are you doing anything on the server side to account for duplicate requests such as these from your users?

matt b
+1  A: 

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.

Josh