Hi all,
I've upgraded from 3.0.5 to 3.1.3.RELEASE. Quite a few things broke as I didn't realise the enormity of the demise of AnnotationMethodHandlerAdapter. However, I got this all back up and running with a custom Java code-based WebConfig and fixes to some of my RequestMappings. All good.
However, now when I come to POST a form which previously worked fine, I'm seeing unexpected behaviour. I use SessionAttributes to keep track of my form-backing objects, and have a controller like so:
Foo objects contain a member Collection<Bar> variable that can have elements added and removed via the form. Adding Bar elements always works fine. Removing Bar elements does not work. I can see in my custom WebBindingInitializer that Spring is correctly passing only the remaining form elements, and not the removed ones. Removing elements in 3.0.x used to work fine with this exact configuration. In 3.1, it does not.Code:@Controller @RequestMapping("/foo") @SessionAttributes("foo") public class EditFooController { ... @RequestMapping(value = {"", "/{fooId}"}, method = RequestMethod.POST) public String processSubmit(@ModelAttribute("foo") Foo<? extends Fooable> foo, ModelMap model, SessionStatus session) throws IOException { requestManager.save(foo); session.setComplete(); model.clear(); return "redirect:/foo/" + foo.getId(); } }
I tried removing the SessionAttribute annotation so that I know I'm getting a new Foo on POST, but get a "Specified class is an interface" error. I don't really want to have to specify a concrete Foo implementation via a @ModelAttribute annotated method (plus, this worked before, as I said).
Any thoughts?
Cheers
Rob


Reply With Quote