Announcement Announcement Module
No announcement yet.
How to pass data from onSubmit to referenceData? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to pass data from onSubmit to referenceData?

    Hi all,
    I have some data that I want to pass from the onSubmit method of my MVC Controller (which 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.

    Thanks in advance for any help.

  • #2
    You can check if the form has been submitted or not by calling the isFormSubmission() method. If it has been submitted, don't call referenceData(). However this requires that you set your form as a session form.


    • #3
      Hi all,
      I figured out the solution to this and it was quiet simple. :jumpingjoy:

      Before in my onSubmit method I was creating a new ModelView and doing a redirect to my successview (that is why I was losing the request)...

      mav = new ModelAndView(successView);
      return mav;
      But now I just did the following...
      else if (pagingRequest != null && pagingRequest.length() > 0)
      		{ // if  paging action go back
      			return showForm(request,response,errors);
      This fixed it. Now I have my request parameters in my referenceData method and I get the correct data for each page.

      Thanks all for any help.