I was wondering if it is possible to chain @ModelAttribute methods by having an @ModelAttribute annotated, but not request mapped, method use another ModelAttribute in the method signature. This would be in a controller.
ie
@ModelAttribute("attrOne") public AttrOne getAttrOne() { return service.getAttOne(); } @ModelAttribute("attrTwo") public AttrTwo getAttrTwo(@ModelAttribute("attrOne") AttrOne attrOne){ return anotherservice.getAttrTwo(attrOne); } Then if there was a request mapped method that did this:
@RequestMapping(method=RequestMethod.GET) public String doSomething(@ModelAttribute("attrTwo") AttrTwo attrTwo ) would this work?
I seem to get a null object for AttrOne in the second annotated method... as the first annotated method is not called by the second one...
Cheers