title: Spring Redirect on Post Method Even Though no POST Method is Implemented
body: <p>I am new at Spring,</p>
  
  <p>I have created new Spring MVC project with the following controller:</p>
  
  <p>@Controller
  public class AccountController {</p>
  
  <pre><code>@RequestMapping(value = "/register", method = RequestMethod.GET)
  public String initForm(Model model){
  
  
  
      WebUser webUser = new WebUser();
      model.addAttribute("user", webUser);
      return "RegistrationForm";
  }
  </code></pre>
  
  <p>}</p>
  
  <p>and with the following JSP</p>
  
  <p>
      <h2>Registration </h2></p>
  
  <pre><code>&lt;form:form method="POST" action="user" modelAttribute ="user"&gt;
      &lt;form:errors path="*" cssClass="errorblock" element="div" /&gt;
      &lt;table&gt;
          &lt;tr&gt;
              &lt;td&gt;First Name :&lt;/td&gt;
              &lt;td&gt;&lt;form:input path="fName" /&gt;
              &lt;/td&gt;
              &lt;td&gt;&lt;form:errors path="fName" cssClass="error" /&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="lName" /&gt;
              &lt;/td&gt;
              &lt;td&gt;&lt;form:errors path="lName" cssClass="error" /&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
              &lt;tr&gt;
              &lt;td&gt;Middle Name :&lt;/td&gt;
              &lt;td&gt;&lt;form:input path="mName" /&gt;
          &lt;/td&gt;
              &lt;td&gt;&lt;form:errors path="mName" cssClass="error" /&gt;
              &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;td&gt;&lt;form:errors path="username" cssClass="error" /&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Password :&lt;/td&gt;
              &lt;td&gt;&lt;form:input path="password" type="password"/&gt;
              &lt;/td&gt;
              &lt;td&gt;&lt;form:errors path="password" cssClass="error" /&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Password Confirmation:&lt;/td&gt;
              &lt;td&gt;&lt;form:input path="confPassword"  type="password" /&gt;
              &lt;/td&gt;
              &lt;td&gt;&lt;form:errors path="confPassword" cssClass="error" /&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Email Address:&lt;/td&gt;
              &lt;td&gt;&lt;form:input path="email" /&gt;
              &lt;/td&gt;
              &lt;td&gt;&lt;form:errors path="email" cssClass="error" /&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
          &lt;tr&gt;        
              &lt;td&gt;Address :&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;        
              &lt;td&gt;Country :&lt;/td&gt;
              &lt;td&gt;&lt;form:input path="country" /&gt;
              &lt;/td&gt;
              &lt;td&gt;&lt;form:errors path="country" cssClass="error" /&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;State :&lt;/td&gt;
              &lt;td&gt;&lt;form:input path="state" /&gt;
              &lt;/td&gt;
              &lt;td&gt;&lt;form:errors path="state" cssClass="error" /&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;City :&lt;/td&gt;
              &lt;td&gt;&lt;form:input path="city" /&gt;
              &lt;/td&gt;
              &lt;td&gt;&lt;form:errors path="city" cssClass="error" /&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Street :&lt;/td&gt;
              &lt;td&gt;&lt;form:input path="street" /&gt;
              &lt;/td&gt;
              &lt;td&gt;&lt;form:errors path="street" cssClass="error" /&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
  
  
          &lt;tr&gt;
              &lt;td&gt;Year of Graduation :&lt;/td&gt;
              &lt;td&gt;&lt;form:input path="yOfGrad" /&gt;
              &lt;/td&gt;
              &lt;td&gt;&lt;form:errors path="yOfGrad" cssClass="error" /&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;tr&gt;
              &lt;td colspan="3"&gt;&lt;input type="submit" value="Submit"/&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/form:form&gt;
  </code></pre>
  
  <p>
  </p>
  
  <p>So every time I click on submit the application redirects me to /User even though I have never specified it any where in the application.</p>
  
  <p>Your help is appreciated!</p>