Announcement Announcement Module
No announcement yet.
Form Data removed on binding exception Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Form Data removed on binding exception

    Hi All,

    I have a form that is a mix of persistent data (command object) and presentation data which I am just spitting out as text to the form. When I hit a binding exception the form data is preserved but the presentation data is lost...unless I set sessionForm to true. Is setting the session form to true my best option for that?

  • #2
    That's tue. Only form data is preserved. If you need to add additional data, and you are using a SimpleFormController, the best place is showForm method. This method executes when there is a GET method, or when there is a Validation o r binding error.

    The method to override is the one with 4 parameters:

    protected  ModelAndView showForm(HttpServletRequest request, HttpServletResponse response, BindException errors, Map controlModel)


    • #3
      Thanks, so is the idea to query the extra data I need and add it to the control data in this method?


      • #4
        Simply overriding referenceData should be enough since it's called from the default showForm implementation anyway.


        • #5
          reference data.....of course thats it. thanks!