I have some data that I want to pass from the onSubmit method of my MVC Controller (extends SimpleFormController) to the referenceData method of that controller. How can I go about doing this?
It is not as simple as putting it as a request attribute because when the code comes to the referenceData a new request is created.
If you are wondering why I need to do this, it is for pagination. In the referenceData method is where I get the default list of rows from the db. But once the user pages I do a form submit on my JSP and get the next page in my onSubmit. The problem now is that when the code comes back to the referenceData after that submit it is overwritting the "paged" list with the original list.
What I am doing is that I am doing a form submit to the same Controller so it should call the onSubmit first. I debugged the code and as I stepped through it I saw that onSubmit was being called first.
I don't think that referenceData() is of any help to you here. If you look at the javadoc, it is called before the initial rendering of the View before the form is submitted. Generally, this is your opportunity to put things in the Model (request attributes) that your form needs when it is rendered before it is submitted. If you want to pass something to another Controller, you can put it in the Model or if you're redirecting to the other Controller you can put it in the session.
kktec<br />SCJP, SCWCD, SCJD<br />"What we observe is not nature itself, but nature exposed to our method of questioning." - Werner Heisenberg