Results 1 to 4 of 4

Thread: How to get the Binding errors in the SimpleFormController

Hybrid View

  1. #1
    Join Date
    Aug 2008
    Location
    Bangalore
    Posts
    11

    Default 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. #2
    Join Date
    Jan 2007
    Location
    Orlando, FL USA
    Posts
    84

    Default

    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
    http://www.jroller.com/thebugslayer - notes on java, scala and other development stuff.

  3. #3
    Join Date
    Dec 2006
    Posts
    311

    Default

    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.

  4. #4
    Join Date
    Aug 2008
    Location
    Bangalore
    Posts
    11

    Default

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

    Regards,
    Sekhar.

Posting Permissions

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