Announcement Announcement Module
Collapse
No announcement yet.
Validation in MultiActionControllers behaviour strange? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Validation in MultiActionControllers behaviour strange?

    What I wish to do is specify a list of validators for a method name. So I inject them into the multi action controller via the validator property.

    To my suprise, the framework invokes the validators before the controller method is executed. And when the form is invalid, the exception below gets thrown to the Jsp. Ideally it would detect errors and i could redirect it back to the view with the command bean and errors bean populated to make use of the form:errors tag. This is what i would expect to happen but whats with this exception?? Why is the closeNoCatch method being called?



    org.springframework.web.bind.ServletRequestBinding Exception: Errors binding onto object 'command'; nested exception is org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBinding Result: 1 errors
    Field error in object 'command' on field 'email1': rejected value [gfhghgj]; codes [defaultMessage.command.email1,defaultMessage.email 1,defaultMessage.java.lang.String,defaultMessage]; arguments []; default message [null]
    org.springframework.web.bind.ServletRequestDataBin der.closeNoCatch(ServletRequestDataBinder.java:121 )
    org.springframework.web.servlet.mvc.multiaction.Mu ltiActionController.bind(MultiActionController.jav a:541)
    org.springframework.web.servlet.mvc.multiaction.Mu ltiActionController.invokeNamedMethod(MultiActionC ontroller.java:470)
    org.springframework.web.servlet.mvc.multiaction.Mu ltiActionController.handleRequestInternal(MultiAct ionController.java:410)
    org.springframework.web.servlet.mvc.AbstractContro ller.handleRequest(AbstractController.java:153)
    org.springframework.web.servlet.mvc.SimpleControll erHandlerAdapter.handle(SimpleControllerHandlerAda pter.java:48)
    org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:875)
    org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:809)
    org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:571)
    org.springframework.web.servlet.FrameworkServlet.d oPost(FrameworkServlet.java:511)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:647)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:729)

  • #2
    You ever get a solution to this? I'm having a similar problem.

    Comment


    • #3
      i can help u to get rid of the exception
      the exception is because u have bind the object in JSP using either
      <spring:nested path=""> or simple by <spring:input path="">
      just remove the path attribute.
      u canot apply the validator as in SimpleFormControlre

      Comment

      Working...
      X