title: Spring-MVC: Need the most simple example of form-processing, binding, and validation
body: <p>I have a form:</p>
  
  <pre><code>&lt;form action="/processform"&gt;
     &lt;input name="firstname" value="john" /&gt;
     &lt;input name="lastname" value="doe" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I have a Person object:</p>
  
  <pre><code>public class Person {
     private String firstname;
     private String lastname;
     // ... getters &amp; setters ...
  }
  </code></pre>
  
  <p>I want to receive this data, perform validation on it, and post it to a datastore.</p>
  
  <p>How do I write a controller to do this? I understand that I could pass the parameters in as request parameters, but I think the "proper" way to do this is somehow bind the data from the form to the Person object and then receive that Person object in the controller and call a Validate object that is configured to receive the Person object.</p>
  
  <p>After much reading, this step has confounded me. Can someone show me what is needed to "bind" the data, "validate" (e.g. a validator), and "process" the data (e.g. the controller, and in particular what gets passed to it as parameters)?</p>