title: SpringMVC HTTP Status 405 - Request method 'POST' not supported
body: <p>I have a form i query the database from that form and is posted to another page with the results. I then select one record from the query results and it takes me back to the page i made the query from so i can update the record. </p>
  
  <p>I click update which takes me back to the controller and to tahe same method first called to query, however the requested parameter is now 'update' so it is suppose to go to the update condition in the method. It seems as though i cannot re-submitt the page to the same url mapping.</p>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>   @RequestMapping(value="citizen_registration.htm", method = RequestMethod.POST)
      public ModelAndView handleRequest(@Valid @ModelAttribute Citizens citizen, 
              BindingResult result,  ModelMap m, Model model,
              @RequestParam(value="user_request") String user_request) throws Exception {
  
  
          try{
               logger.debug("In Http method for CitizenRegistrationController - Punishment Registration");
               logger.debug("User Request Is " + user_request);
  
  
                   if(result.hasErrors()){
  
                  //handle errors
  
                      // return new ModelAndView("citizen_registration");
                   }else{
  
                       //check if its a save or an update
  
                       if(user_request.equals("Save"))
                          //do save
  
                          else if (user_request.equals("Query"))
  
                          //do query
  
                          else if (user_request.equals("Update"))
                          //do update
  
                  }
      }
  </code></pre>
  
  <p><strong>Error log</strong></p>
  
  <pre><code>34789 [http-bio-8084-exec-3] DEBUG org.springframework.web.servlet.DispatcherServlet  - Bound request context to thread: org.apache.catalina.connector.RequestFacade@2ba3ece5
  34791 [http-bio-8084-exec-3] DEBUG org.springframework.web.servlet.DispatcherServlet  - DispatcherServlet with name 'crimetrack' processing POST request for [/crimeTrack/getCitizen/citizen_registration.htm]
  34792 [http-bio-8084-exec-3] DEBUG org.springframework.web.servlet.DispatcherServlet  - Testing handler map [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping@3a089b3] in DispatcherServlet with name 'crimetrack'
  34792 [http-bio-8084-exec-3] DEBUG org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping  - Looking up handler method for path /getCitizen/citizen_registration.htm
  34796 [http-bio-8084-exec-3] DEBUG org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver  - Resolving exception from handler [null]: org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported
  34796 [http-bio-8084-exec-3] DEBUG org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver  - Resolving exception from handler [null]: org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported
  34796 [http-bio-8084-exec-3] DEBUG org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver  - Resolving exception from handler [null]: org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported
  34796 [http-bio-8084-exec-3] WARN  org.springframework.web.servlet.PageNotFound  - Request method 'POST' not supported
  34796 [http-bio-8084-exec-3] DEBUG org.springframework.web.servlet.DispatcherServlet  - Null ModelAndView returned to DispatcherServlet with name 'crimetrack': assuming HandlerAdapter completed request handling
  34796 [http-bio-8084-exec-3] DEBUG org.springframework.web.servlet.DispatcherServlet  - Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade@2ba3ece5
  34796 [http-bio-8084-exec-3] DEBUG org.springframework.web.servlet.DispatcherServlet  - Successfully completed request
  34796 [http-bio-8084-exec-3] DEBUG org.springframework.web.context.support.XmlWebApplicationContext  - Publishing event in WebApplicationContext for namespace 'crimetrack-servlet': ServletRequestHandledEvent: url=[/crimeTrack/getCitizen/citizen_registration.htm]; client=[127.0.0.1]; method=[POST]; servlet=[crimetrack]; session=[null]; user=[null]; time=[8ms]; status=[OK]
  34796 [http-bio-8084-exec-3] DEBUG org.springframework.web.context.support.XmlWebApplicationContext  - Publishing event in Root WebApplicationContext: ServletRequestHandledEvent: url=[/crimeTrack/getCitizen/citizen_registration.htm]; client=[127.0.0.1]; method=[POST]; servlet=[crimetrack]; session=[null]; user=[null]; time=[8ms]; status=[OK]
  </code></pre>
  
  <p><strong>FireBug</strong></p>
  
  <p>Inspecting FireBug I got this <code>"NetworkError: 405 Method Not Allowed - http://localhost:8084/crimeTrack/getCitizen/citizen_registration.htm"</code> this should be <code>http://localhost:8084/crimeTrack</code>/citizen_registration.htm"`</p>
  
  <p>The getCitizen is the page i was taken to when the query was first executed it got included in the url. </p>
  
  <p>I changed the jsp form action definition to <code>&lt;form:form id="citizenRegistration" name ="citizenRegistration" method="POST" commandName="citizens" action="&lt;%=request.getContextPath()%&gt;/citizen_registration.htm"&gt;</code> however when i start the application and make a request to this page i get:</p>
  
  <pre><code>HTTP Status 500 - /WEB-INF/jsp/citizen_registration.jsp (line: 31, column: 116) attribute for %&gt;" is not properly terminated 
  </code></pre>