title: spring mvc 3 - SessionAttributes doesn't seem to be working
body: <p>I have tried and tried but can't figure out what is going on here. </p>
  
  <ol>
  <li>I have a simple controller annotated using @Controller</li>
  <li>I also have annotation for @SessionAttributes</li>
  <li>I handle a GET request and put an object into the model. </li>
  <li>When I get back the POST from the form, I only get back what the user has populated. I'm not getting back the complete object. </li>
  </ol>
  
  <p>I'm new to SessionAttributes but I thought this preserved the whole object and when the object was read back in the method using @ModelAttribute, it would be merged the object (i.e. the object that the form changed). However, I'm not seeing this behavior. </p>
  
  <p>Any help would be much appreciated. </p>
  
  <p>Here is the relevant pieces from the code: </p>
  
  <pre><code>@Controller
  @RequestMapping("/user")
  @SessionAttributes("user")
  public class UserController 
  {
        // ... 
  
  @RequestMapping(value = "/{login}", method = RequestMethod.GET)
  public String profile(Model model, @PathVariable("login") String login)
        {
             // ...
             model.addAttribute("user", user); 
             // ...
        }
  
  @RequestMapping(value="/{login}", method = RequestMethod.POST)
  public String saveProfile(@ModelAttribute("user") @Valid User user, BindingResult result, SessionStatus status)
  {
       if (result.hasErrors())
             {
             return "user/index";
       }
             // ... 
             status.setComplete();
       return "redirect:/user/"+user.getLogin(); 
  }
  </code></pre>
  
  <p>Do you see anything that I may have missed? I have spent almost a day trying to figure this out and just can't. Any help would be much appreciated. </p>
  
  <p><strong>Update: I figured out what the issue was. Answer posted below.</strong> </p>