Spring 3 web request interceptor - how do I get BindingResult?

后端 未结 2 1453
青春惊慌失措
青春惊慌失措 2021-01-21 07:40

I realy appreciate Spring 3 anoation driven mapping of Web Controllers

I have a lot of Controllers with signatures like:

@RequestMapping(value = \"solici         


        
2条回答
  •  醉梦人生
    2021-01-21 08:27

    So with big help from @Axtavt I came to conlusion, that you can get to Bind reuslt from ModelAndView in postHandle method:

    void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) {
      String key = BindingResult.MODEL_KEY_PREFIX + "commandName";
      BindingResult br = (BindingResult) modelAndView.getModel().get(key);
    }
    

提交回复
热议问题