Announcement Announcement Module
Collapse
No announcement yet.
@MVC <form:errors> What Model Attribute? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • @MVC <form:errors> What Model Attribute?

    I want to return a ModelAndView object to my view when validation fails. I am able to add the command object to the ModelAndView as my command name. This allows MVC to redisplay the user's data. I also have a BindingResult object I need in the ModelAndView. What key does the BindingResult need to be under in the ModelAndView so the <form:errors> tag to find it?

  • #2
    No one knows what model attribute <form:erros> is looking for?

    Comment


    • #3
      Figured this out after digging through some of the MVC source.

      Code:
      ModelAndView mav = new ModelAndView();
      Map model = result.getModel();
      mav.addAllObjects(model);
      That puts all of the binding stuff in the ModelAndView. result is a BindingResult object which implements Errors.

      Comment

      Working...
      X