Errors/BindingResult argument declared without preceding model attribute

spring 3 mvc BindingResult result 校验注意点

BindingResult result 的使用,必须在controller层增加@ModelAttribute("fundsPreTransfer") 它和ModelAttribute同时使用,并且参数要紧挨着。这样才不会报。Errors/BindingResult argument declared without preceding model attribute异常。

具体可以查看org.springframework.web.bind.annotation.support.HandlerMethodInvoker

In the submit method (the RequestMethod.POST one) of an annotation form controller, if you use @ModelAttribute and BindingResult, the BindingResult must immediately follow the @ModelAttribute. Otherwise, you get an error: "Errors/BindingResult argument declared without preceding model attribute. Check your handler method signature". Spoiled by Spring 3.0 MVC, I put parameters in any order I want in a controller. I run into an exception today.

你可能感兴趣的:(spring)