I am experiencing a very peculiar behavior with Spring MVC 3.1.0.M2 that suddenly popped out:
@Controller
@RequestMapping("/admin/participants/{participantId}")
public class ParticipantEditController extends ParticipantControllerSupport {
@ModelAttribute("participant")
public Participant getParticipant(
@PathVariable("participantId") final long participantId) {
// ...
}
@RequestMapping(value = "/{tab}/edit", method = RequestMethod.PUT)
public ModelAndView save(
@ModelAttribute("participant") final Participant participant,
final BindingResult errors) {
// ...
}
}
When I'm submitting my form I get the following exception:
java.lang.IllegalStateException: Errors/BindingResult argument declared without preceding model attribute. Check your handler method signature!
at org.springframework.web.method.annotation.support.ErrorsMethodArgumentResolver.resolveArgument(ErrorsMethodArgumentResolver.java:60)
at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:65)
...
What's troubling me is that my BindingResult does immediately follow the model attribute in the method signature.
I've tried it with and without a @Valid annotation and with more or less other parameters, to no avail.
Does anyone know what I'm doing wrong? Any help greatly appreciated.