title: Can not send FormData from JSP page using jquery-AJAX to Servlet
body: <p>Trying to send POST data from JSP file using jQuery-AJAX to servlet, but getting null values in servlet post request. </p>
  
  <p>On JSP page , in console it is displaying proper data and in post request it is showing me that it is sending data, i have checked that using firebug in mozilla. But getting null values in servlet.</p>
  
  <p>JSP-Code:</p>
  
  <pre><code>        &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  
          &lt;script src="js/jquery-1.8.3.js" type="text/javascript"&gt;&lt;/script&gt;
          &lt;script type="text/javascript" src="js/jquery-ui-1.8.24.js"&gt;&lt;/script&gt;
          &lt;script type="text/javascript"&gt;
              $( document ).ready(function() {
  
      alert("DOM is ready");
  
  });
  
               function qry()
              {
  
                  var fd = new FormData();                               
                  var tinfo=$("#tablename").val();                   
                  var cinfo=$("#columnname").val();
                  var oinfo=$("#operator").val();
                  var uinfo=$("#txtuserinput").val();
                   console.log(tinfo);
                  console.log(cinfo);
                  console.log(oinfo);
                  console.log(uinfo);
  
                  fd.append("abc",tinfo);
              fd.append("mycolumnname",cinfo);
              fd.append("myoperator",oinfo);
              fd.append("mytxtuserinput",uinfo);
  
                   $.ajax({       
  
                                  type: 'POST',
                                  url: "http://localhost:8084/NavigatingApp/getInfo/queryoutput",     
                                  contentType: false,
                                  dataType: "html",
                                  data: fd,                                
          async:false,            
          cache: false,
  
          processData: false,                
  
                  success:function(data){
                      console.log(data);
  
                          },
          error:function(){
              alert("Error in receving data...!!!");
          }
      });
              }
              &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;h1&gt;Hello World!&lt;/h1&gt;
          &lt;select name="tablename" id="tablename" &gt;
              &lt;option value="tbl1"&gt;tbl1&lt;/option&gt;
              &lt;option value="tbl2"&gt;tbl2&lt;/option&gt;
              &lt;option value="tbl3"&gt;tbl3&lt;/option&gt;            
          &lt;/select&gt;
          &lt;select name="columnname" id="columnname"&gt;
              &lt;option value="col1"&gt;col1&lt;/option&gt;
              &lt;option value="col2"&gt;col2&lt;/option&gt;
              &lt;option value="col3"&gt;col3&lt;/option&gt;
          &lt;/select&gt;
          &lt;select name="operator" id="operator"&gt;
              &lt;option value="op1"&gt;op1&lt;/option&gt;
              &lt;option value="op2"&gt;op2&lt;/option&gt;
              &lt;option value="op3"&gt;op3&lt;/option&gt;
          &lt;/select&gt;
          &lt;select name="condition" id="condition" &gt;
              &lt;option value="condtn1"&gt;condtn1&lt;/option&gt;
              &lt;option value="condtn2"&gt;condtn2&lt;/option&gt;
              &lt;option value="condtn3"&gt;condtn3&lt;/option&gt;
          &lt;/select&gt;
          &lt;input type="text" name="txtuserinput" id="txtuserinput" /&gt;
            &lt;input type="button" value="search" id="btnsearch" onclick="qry();" /&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Servlet Code:</p>
  
  <pre><code>@WebServlet(name = "queryoutput", urlPatterns = {"/queryoutput"})
  public class QueryOutput extends HttpServlet {
   public QueryOutput() {
          super();
          // TODO Auto-generated constructor stubatavu
  
      }
  
      @Override
      protected void doGet(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
  
      }
  
  
      @Override
      protected void doPost(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
  
  
              response.setContentType("application/json;charset=UTF-8");
  
  
              System.out.println(" inside do post table::" +request.getParameter("mytablename"));
              System.out.println(" inside do post col name:: " +request.getParameter("mycolumnname"));
              System.out.println(" inside do post operator::" +request.getParameter("myoperator"));
              System.out.println(" inside do post user input::" +request.getParameter("mytxtuserinput"));
                response.setContentType("application/json;charset=UTF-8");
  
              PrintWriter out=response.getWriter();
  
  
                out.flush();
  
      }    
  }
  </code></pre>