ModelAttribute « MVC Controller « Spring Q&A





1. SpringMVC: Can I specify a @ModelAttribute be populated only for specific controller methods?    stackoverflow.com

We have a couple of attributes that are common to 90% of the pages in our webapp. I'd like to simply declare an @ModelAttribute("userCredits") on my controller to populate this common attribute. However, ...

2. How to reset a @ModelAttribute in Spring MVC after it has been processed in the controller?    stackoverflow.com

I have defined a @ModelAttribute("mymodel")

@ModelAttribute("mymodel")
MyModel mymodel() {
  MyModel mymodel = new MyModel();
  return mymodel;
 }


@RequestMapping(value = "/save", method = RequestMethod.POST)
public final void save(@ModelAttribute("mymodel") MyModel mymodel, 
    ...

3. @ModelAttribute and XML configured controllers    forum.springsource.org

@ModelAttribute and XML configured controllers I have a webapp I'm developing, that has thus far been written using @Controller, @RequestMapping and @ModelAttribute annotations for all of the web controllers. This has ...