Announcement Announcement Module
Collapse
No announcement yet.
How to get the Binding errors in the SimpleFormController Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to get the Binding errors in the SimpleFormController

    Dear all,
    I'm new to the spring MVC.I've written a controller by extending SimpleFormController class.When i'm submitting the form it's not invoking onSubmit(), not switching to the success page because of unknown reasons(may be validation failed).
    How to get these binding errors ? i wanted to display them in the JSP page. I don't have clue abt the error since it's not displaying anything after submitting.

    Can any one has an idea abt this ?

    Thanks,
    Sekhar.

  • #2
    Hello SekHar,
    Try adding <form:errors path="*"> to your formView.

    If you still has no clue, then you probably haven't read Referrence througly, as it explain very clearly to me how the form and display works. Find the ref here:
    http://static.springframework.org/sp...glib-errorstag

    -Z

    Comment


    • #3
      If the code isnt getting to onSubmit then there is more of a problem then displaying binding errors (due to type mismatch and the such). Post your code for you controller and lets take a look. Its possible that you have the wrong import for your BindException errors object.....make sure its the spring one. Thats a killer. Or maybe your method signature is not correct.....make sure its protected not private.

      You can always override:

      protected void onBind(HttpServletRequestrequest,
      Object command,
      BindException errors)
      throws Exception

      Then loop through the fieldErrors in the errors object to see what field errors you are getting.

      Comment


      • #4
        Thanks to both of you.It's displaying the errors now.

        Regards,
        Sekhar.

        Comment

        Working...
        X