title: Bind of the model with view in POST with Spring MVC 3
body: <p>I'm trying to do a dependency injection in my controller, instead using setters methods, but it didnot work. The purpose is bind the form inputs with attributes of my domain model when do the post of the data form - with the controller.</p>
  
  <p>What I want: just bind the domain model with my form, in a controller class using springframework 3.1.</p>
  
  <p>My domain class:</p>
  
  <pre><code>public class Person {
  
    private String name;
  
    @Autowired
    public Person(String name) {
      this.name = name;
    }
  
    public String getName() {
      return this.name;
    }
  
  }
  </code></pre>
  
  <p>My jsp(person-get):</p>
  
  <pre><code>&lt;form action="test-person" method="post"&gt;
  &lt;table cellpadding="0" cellspacing="0" align="center"&gt;
    &lt;tr&gt;
        &lt;td&gt; &lt;b&gt; NAME: &lt;/b&gt; &lt;/td&gt;
        &lt;td&gt; &lt;input type="text" id="name" name="name"&gt; &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt; 
  &lt;/form&gt;
  </code></pre>
  
  <p>My Controller:</p>
  
  <pre><code>@Controller
  public class PersonController {
  
  @RequestMapping(value = "test-person", method = RequestMethod.GET)
  public String loadViewGet() {       
    return "person-get";
  }
  
  @RequestMapping(value = "test-person", method = RequestMethod.POST)
  public String doPost(Person person, Model model) {
  
      model.addAttribute("person", person);
  
      return "person-post";
      }
  
  }
  </code></pre>
  
  <p>And the last jsp showing the entered name of the person by the user (person-post):</p>
  
  <pre><code>&lt;table cellpadding="0" cellspacing="0" align="center"&gt;
  &lt;tr&gt;
      &lt;td&gt; &lt;b&gt; NAME: &lt;/b&gt; &lt;/td&gt;
      &lt;td&gt; ${person.name} &lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt; 
  </code></pre>
  
  <p>There's a way to bind the form inputs with my my model class (Person) without using setter methods?</p>
  
  <p>Anyone knows another web framework for java that could make this?</p>
  
  <p>Thanks!</p>