title: Spring MVC HTTP Status 400 -
body: <p>I am trying to create a program where I am getting the error</p>
  
  <p>Edit.jsp</p>
  
  <pre><code>&lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt;
  &lt;%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %&gt;
  &lt;%@taglib uri="http://www.springframework.org/tags/form" prefix="form" %&gt;
  &lt;%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %&gt;
  &lt;html&gt;
  &lt;body&gt;
  &lt;c:if test="${session_username != null }"&gt;Hello ${session_username}!&lt;/c:if&gt;
      &lt;font face="verdana" size="2"&gt;
          ${welcomeMessage} &lt;BR&gt;&lt;BR&gt;
          &lt;form:form action="${pageContext.request.contextPath}/editemployee" method="POST" modelAttribute="editForm"&gt;
              &lt;form:errors path="studenterrors" /&gt;
              &lt;table&gt;
                  &lt;tr&gt;
                      &lt;td colspan="2" align="center"&gt;Spring MVC Form Demo - Edit&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;User Name&lt;/td&gt;
                      &lt;td&gt;&lt;form:input path="username" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;First Name&lt;/td&gt;
                      &lt;td&gt;&lt;form:input path="firstname" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Last Name&lt;/td&gt;
                      &lt;td&gt;&lt;form:input path="lastname" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Mobile No.&lt;/td&gt;
                      &lt;td&gt;&lt;form:input path="mobileno" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Password&lt;/td&gt;
                      &lt;td&gt;&lt;form:password path="password" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Email&lt;/td&gt;
                      &lt;td&gt;&lt;form:input path="email" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;BirthDate (mm/dd/yyyy)&lt;/td&gt;
                      &lt;td&gt;&lt;form:input path="birthdate" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Profession&lt;/td&gt;
                      &lt;td&gt;&lt;form:select path="profession" items="${professionList}" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td colspan="2" align="center"&gt;&lt;input type="submit" value="Submit" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;                                   
              &lt;/table&gt;                                        
          &lt;/form:form&gt;
      &lt;/font&gt; 
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>LoginSuccess.java</p>
  
  <pre><code>package java4s;
  
  
  import java.util.ArrayList;
  import java.util.List;
  
  import javax.servlet.http.HttpSession;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.context.annotation.Scope;
  import org.springframework.stereotype.Controller;
  import org.springframework.ui.ModelMap;
  import org.springframework.web.bind.annotation.ModelAttribute;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestMethod;
  import org.springframework.web.servlet.ModelAndView;
  
  import java4s.EmployeeService;
  
  @Controller
  public class LoginSuccessController {
  
      @Autowired
      EmployeeService emp_service;
  
      @RequestMapping(value = "/editemployee", method=RequestMethod.POST)
      public ModelAndView EditSaveMyInfo(ModelMap model, @ModelAttribute("editForm") Employee employee) {
  
          model.addAttribute("message", "Information Updated");
          return new ModelAndView("EditSuccess",model);
      }
  
  }
  </code></pre>
  
  <p>Whenever I click on submit button, I get <code>HTTP Status 400 -</code> error. But when I remove <code>@ModelAttribute("editForm") Employee employee</code> from the function <code>EditSaveMyInfo</code>, the error doesnt appears?</p>
  
  <p>How can I solve the error?</p>
  
  <p>EDIT</p>
  
  <p>Employee.java</p>
  
  <pre><code>package java4s;
  
  import java.util.Date;
  
  public class Employee {
  
      private String userid;
      private String firstname;
      private String lastname;    
      private String mobileno;
      private String username;
      private String password;
      private String email;
      private Date birthDate;
      private String profession;
      private String studenterrors;
  
      public String getUserid()
      {
          return userid;
      }
      public void setUserid(String userid)
      {
          this.userid = userid;
      }
  
      public String getUsername()
      {
          return username;
      }
      public void setUsername(String username)
      {
          this.username = username;
      }
      public String getFirstname()
      {
          return firstname;
      }
      public void setFirstname(String firstname)
      {
          this.firstname = firstname;
      }
      public String getLastname()
      {
          return lastname;
      }
      public void setLastname(String lastname)
      {
          this.lastname = lastname;
      }
      public String getMobileno()
      {
          return mobileno;
      }
      public void setMobileno(String mobileno)
      {
          this.mobileno = mobileno;
      }
  
      public String getPassword()
      {
          return password;
      }
      public void setPassword(String password)
      {
          this.password = password;
      }
          public String getEmail()
      {
          return email;
      }
      public void setEmail(String email)
      {
          this.email = email;
      }
          public Date getBirthdate()
      {
          return birthDate;
      }
      public void setBirthdate(Date birthDate)
      {
          this.birthDate = birthDate;
      }
          public String getProfession()
      {
          return profession;
      }
      public void setProfession(String profession)
      {
          this.profession = profession;
      }
          public String getstudenterrors()
      {
          return studenterrors;
      }
      public void setstudenterrors(String studenterrors)
      {
          this.studenterrors = studenterrors;
      }
  }
  </code></pre>