title: Objects binding in Spring MVC form
body: <p>I'm working on a test application using Spring MVC.
  I have a <code>Person</code> class and a <code>Group</code> class. Every <code>Person</code> object references a <code>Group</code> object.</p>
  
  <p>Now I implemented a jsp that show Person data and allow editing. Inside my form i put a select control to select the pearson's group:</p>
  
  <pre><code>&lt;sf:select path="group"&gt;
      &lt;sf:options items="${groupList}" itemLabel="name" itemValue="id" /&gt;
  &lt;/sf:select&gt;
  </code></pre>
  
  <p>It shows the correct group when I load the page, but I cannot save changes, because in the controller I get only the string representing the group <strong>id</strong>.</p>
  
  <p>So, my question is: how can I obtain a <code>Group</code> object instead of its id in my controller?</p>
  
  <p><strong>UPDATE</strong>
  Here my controller code:</p>
  
  <pre><code>@RequestMapping(value = "/details", params = "save", method = RequestMethod.POST)
  public String save(@ModelAttribute("person") Person p,
          BindingResult result) {
      this.personManager.savePerson(p);
      return "redirect:/people/details?id=" + p.getId();
  }
  </code></pre>