Announcement Announcement Module
No announcement yet.
Newbie - form population when bindandvalidate fails Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Newbie - form population when bindandvalidate fails


    I am currently facing a problem with bind and validate of my form. The situation is as follows:

    I have a form which shows the details of a user. This form is being populated with the values from DB. I am placing a bean in the request scope and populating the values through <c:out> tags inside the textboxes and labels. The textboxs are given the same names as that of the form-object properties which is setup in the request scope. The dropdowns are being populated with a list put in the request scope.

    When a string is entered into a textfield, which is marked as an Integer in the form object, the bind and validate fails as expected. The error message is correctly being shown using the <spring:bind> tag. But my problem is, when it comes back to the original view all the values populated from the DB are gone.

    I tried placing the form object and the list in the flowscope, but still only the values in the dropdowns and checkboxes are being populated. All the values in textboxes and labels are gone.

    Could someone please help me out of this....


  • #2
    If the form object is in flow scope, and it is the basis for what gets displayed in the text field, it should repopulate correctly.

    Now obviously if you just put it in request scope you need to ensure on a new request you repopulate before going back to the view state. A view state "setup" action can help with this.



    • #3
      Thank you, Keith.

      It was my mistake. I was putting the form object into the request scope. Changing it to flow scope did the trick.