title: Get Method is getting called but I have given POST method in my form
body: <p>I am calling a POST method from JSP but by default, GET is getting called in servlet and none of the post parameters are coming in the request.</p>
  
  <p>I have checked all the existing questions but none of them is solving my problem as I am submitting the form from the javascript method.</p>
  
  <p>Same JSP, js and java code is working fine in my live environment.</p>
  
  <p>So I am not able to understand, is it some version issue or what. Still, I'm putting my code below if anything can be changed to make it work.</p>
  
  <p>I have tried putting the encoding tag in form enctype as in one solution it is given that encoding can be one issue sometimes but didn't work. </p>
  
  <p>JSP Code:</p>
  
  <pre><code> //web.xml configuration is done properly
      &lt;form action="FileDownloadServlet" method="POST" id="fDownload"&gt;
          &lt;input type="hidden" name="fileId" id="fileId"/&gt;
          &lt;input type="hidden" name="status1" id="status1"/&gt;
          &lt;input type="hidden" name="volume1" id="volume1"/&gt;
          &lt;input type="hidden" name="fileType" id="fileType" value="summaryPDF"/&gt;
          &lt;input type="hidden" name="documentType" id="documentType" value="SO"/&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>JS Code is below:</p>
  
  <pre><code>//It is fetching the below values from a form on the current page storing values in hidden and it is printing these values in js properly.
  
  
      var docID = dwr.util.getValue("docId");
          var status = dwr.util.getValue("status");
          var volume = dwr.util.getValue("volume");
          jq('#fileId').val(docID);
          jq('#status1').val(status);
          jq('#volume1').val(volume);
          document.forms[0].action = "FileDownloadServlet";
          document.forms[0].submit();
  </code></pre>
  
  <p>Servlet Code:</p>
  
  <pre><code>                         //In form we gave POST as form method but still output is calling doGet
            @Override
              protected void doGet(HttpServletRequest request, HttpServletResponse response)
                      throws ServletException, IOException {
                  System.out.println("calling doGet");
                  processRequest(request, response);
              }
  
              @Override
              protected void doPost(HttpServletRequest request, HttpServletResponse response)
                      throws ServletException, IOException {
                       System.out.println("calling doPost");
                  processRequest(request, response);
              }
  </code></pre>
  
  <p>It is calling GET method every single time.</p>