Any suggestions on how to handle form re-submission in Spring MVC 3 with annotations.
I tried implementing Post-Rediect-Get design pattern but it doesnt work in IE and once Get request crosses it's no. of character in request string it stops working in mozilla as well.
Any tutorial or Blog Or suggestion please.
There is nothing like trying, either you do it or you don't.
Sounds like you are doing something wrong. What kind of page are you trying to redirect to? Typically it would be a success page or the same page but with a success message. Where all the extra parameters coming from? Post some code so we can see what you are trying to do.
Well, I've a report page getUserDetails.jsp which has form fields such as username, startdate and enddate, producttype.
User fill all these fields clicks on submit. Application displays a report to the user accordingly which is displayed using jqGrid. Therefore I'm passing JSONString to jsp page.
Code looks something like this:
Well, what are the various ways using which we can avoid double form submission in spring mvc 3.0??
Well at first glance it looks like when you are posting in you are adding a userlist to the model before redirecting to the get. All of those parameters are going to translate into URL parameters, which is why you are getting the error.
One thing you could do is have the GET method look up the user list and return it rather than having the POST method place it on the model. If you need to pass some additional message information to the page you can also make use of RedirectAttributes.
Typically on the POST method you would either have a BindingResult or a @Valid or implement the Validator interface and only do the redirect if the BindingResult does not have errors otherwise you would return them to the form. Otherwise on an erroneous form submission they will be re-directed and will be unable to rectify the problem.
redirect works just fine in IE 8 on all of my projects is there a particular exception your are getting? If so please post it. That is the pattern that is used to handle that particular issue. Did you read the link I gave?
subject: How to handle form re-submission in spring-mvc-3