Spring MVC: BindingResult allegedly declared without preceding model attribute?

I hope this is not the correct answer. Try not declaring your parameters as final. Ex.

Up vote 0 down vote favorite share g+ share fb share tw.

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.

Spring spring-mvc link|improve this question asked Sep 22 '11 at 19:09Philipp Jardas562213 80% accept rate.

This may be a bug in the ErrorsMethodArgumentResolver (or a releated class). Consider reporting it to the spring team. 3.1.0.

M2 is still a development release; it may be a good idea to get 3.0.6 (the latest ga release) and see if you can reproduce the error. – DwB Sep 23 '11 at 13:00 I have submitted this topic to the Spring community forums: forum.springsource.org/… – Philipp Jardas Sep 24 '11 at 9:01.

I hope this is not the correct answer. Try not declaring your parameters as final. Ex.

Public ModelAndView save( @ModelAttribute("participant") Participant participant, BindingResult errors).

I can happily confirm that this is not the correct answer. :-) – Philipp Jardas Sep 23 '11 at 7:18.

I have found the problem. The culprit was another method in a parent class that used a ' @ModelAttribute to calculate another model attribute: @ModelAttribute("foobar") public String getFoobar(@ModelAttribute("participant") Participant participant) { ... }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions