title: How to fix "org.springframework.web.HttpRequestMethodNotSupportedException : Request method 'POST' not supported ?"
body: <p>So I'm getting an warning as</p>
  
  <pre><code> WARN  [org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver] (default task-2) Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported] 
  </code></pre>
  
  <p>when I go to the following URL <code>http://localhost:8080/ProjectFE/uregistration</code>
   and the website shows  </p>
  
  <blockquote>
    <p>HTTP 405 Method not allowed </p>
  </blockquote>
  
  <p>here is my controller code:</p>
  
  <pre><code>package controller;
  
  import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.ModelAttribute;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestMethod;
  
  import model.daoimpl.UserinfoDaoImpl;
  import model.dao.IUserinfoDAO;
  import model.entity.Userinfo;
  
  @Controller
  public class RegistrationController {
      @RequestMapping(value="/registration",method = RequestMethod.GET)
      public String addRegistrationPage() {
          return "registrationpage";
      }
      @RequestMapping(value="/uregistration",method = RequestMethod.POST)
      public String addURegistrationPage(@ModelAttribute("User")Userinfo u) {
          IUserinfoDAO iu = new UserinfoDaoImpl();
          boolean b = iu.insertInfo(u);
          if(b)
              return "success";
          else
              return "registrationpage";
      }
  
  }
  </code></pre>
  
  <p>So what should I do ? Also if any other code is required please comment I'll edit the post,
  Thankyou.</p>