java - @ModelAttribute annotated method WITH @ModelAttribute in method signature -


I was thinking that @ModelAttribute is annotated due to series @ model attribute methods, but no request for map Another model attribute in the method used to sign the method, has been done. It will be in a controller.

i.e.

  @ Modal Unbreakable ("Attien") Public AttrOne getAttrOne () {return service.getAttOne (); } @ModelAttribute ("Attito") Public Attoo Two Atto Two (@model attribute ("Attien") AtronOuton) {return another service. Atreuben (Atrium); }   

Then, according to some mapped method it was done:

  @RequestMapping (method = RequestMethod.GET) public string doSomething ( @ModelAttribute ("AttrTwo") AttrTwo attrTwo)   

Will this work?

I am getting a blank object for AttrOne in the second comment method ... the first comment is not called by the other ...

Cheers

I took part in the same situation by learning from Spring Document:

@ModelAttribute The method is also used at the level [..] . The method signing for this use may include the same type as the above document for @RequestMapping annotation.

I found out that in which face of this problem, you can get a workaround by providing the only one @ Model Attractive Annotation method in the model Property sets:

  @ModelAttribute Public Zero populateModel (Model Model) {Model.addAttribute ("Attien", getAttrOne ()); Model.addAttribute ("attrTwo", getAttrTwo ()); }    

Comments