Spring 3 web请求拦截器 - 我如何获得BindingResult?

Hur*_*rda 3 java web-applications spring-mvc interceptor

我真的很欣赏Spring 3 anoation驱动的Web控制器映射

我有很多带有签名的控制器:

@RequestMapping(value = "solicitation/create",method = RequestMethod.POST)
public String handleSubmitForm(Model model, @ModelAttribute("solicitation") Solicitation  solicitation, BindingResult result) 
Run Code Online (Sandbox Code Playgroud)

但我的问题是,我想编写一个拦截器,它会在处理后通过BindingResults - 我如何从HttpRequest或HttpResponse获取它们?

因为intercpetor方法具有相似的签名

public boolean postHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
Run Code Online (Sandbox Code Playgroud)

axt*_*avt 8

执行控制器方法后,BindingResult将其存储为名为的模型属性BindingResult.MODEL_KEY_PREFIX + <name of the model attribute>,以后将模型属性合并到请求属性中.因此,在合并之前,您可以在合并使用后使用Hurda自己的答案:

request.getAttribute(BindingResult.MODEL_KEY_PREFIX + "solicitation")
Run Code Online (Sandbox Code Playgroud)