Results 1 to 5 of 5

Thread: Form Data removed on binding exception

  1. #1
    Join Date
    Dec 2006
    Posts
    311

    Default 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. #2
    Join Date
    Dec 2007
    Posts
    130

    Default

    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:

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

  3. #3
    Join Date
    Dec 2006
    Posts
    311

    Default

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

  4. #4
    Join Date
    Oct 2008
    Location
    Delhi, India
    Posts
    163

    Default

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

  5. #5
    Join Date
    Dec 2006
    Posts
    311

    Default

    reference data.....of course thats it. thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •