title: Spring 4 - HTTP Status 400, Required parameter is not present
body: <p>I have Spring form in <strong>index.jsp</strong>:</p>
  
  <pre><code>&lt;%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %&gt;
  &lt;html&gt;
  &lt;body&gt;
  &lt;form:form action="save" name="employeeDTO" method="POST"&gt;
          &lt;label for="name"&gt;Name&lt;/label&gt;&lt;input id="name" type="text" required&gt;&lt;br&gt;
          &lt;label for="surname"&gt;Surname&lt;/label&gt;&lt;input id="surname" type="text" required&gt;&lt;br&gt;
          &lt;label for="email"&gt;E-mail&lt;/label&gt;&lt;input id="email" type="email" required&gt;&lt;br&gt;
          &lt;label for="salary"&gt;Salary&lt;/label&gt;&lt;input id="salary" type="number" required&gt;&lt;br&gt;
          &lt;input type="submit" value="Save"&gt;
  &lt;/form:form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>In <strong>WorkController.java</strong> I try to map form submit (at this moment, it doesn't do anything with data):</p>
  
  <pre><code>@Controller
  public class WorkController {
  
      @RequestMapping(value = "/save", method = RequestMethod.POST)
      public String save(@RequestParam EmployeeDTO employeeDTO){
          return "saved";
      }
  }
  </code></pre>
  
  <p>But I got HTTP 400 Status: <code>Required EmployeeDTO parameter 'employeeDTO' is not present</code> with description: <code>The request sent by the client was syntactically incorrect.</code></p>
  
  <p>There is <strong>EmployeeDTO.java</strong>:</p>
  
  <pre><code>public class EmployeeDTO implements Serializable, DTO {
      private Long id;
      private String name;
      private String surname;
      private String email;
      private Double salary;
  
      public EmployeeDTO(){}
  
      public EmployeeDTO(Long id, String name, String surname, String email, Double salary){
          this.id = id;
          this.name = name;
          this.surname = surname;
          this.email = email;
          this.salary = salary;
      }
  
      public Long getId() {
          return id;
      }
  
      public void setId(Long id) {
          this.id = id;
      }
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public String getSurname() {
          return surname;
      }
  
      public void setSurname(String surname) {
          this.surname = surname;
      }
  
      public String getEmail() {
          return email;
      }
  
      public void setEmail(String email) {
          this.email = email;
      }
  
      public Double getSalary() {
          return salary;
      }
  
      public void setSalary(Double salary) {
          this.salary = salary;
      }
  
      @Override
      public Serializable toEntity() {
          return new Employee(getId(), getName(), getSurname(), getEmail(), getSalary());
      }
  }
  </code></pre>
  
  <p>If I remove <code>@RequestParam EmployeeDTO employeeDTO</code> from <code>save</code> method signature - it works, it redirects to <code>saved.jsp</code> file. Earlier, I uses <code>@RequestParam String name, @RequestParam String surname etc</code> to catch data from HTML forms. Is there any solution to "catch" data from Spring form as DTO object? I wolud be happy if anbyody decides to help me - thank you in advance.</p>