title: Java servlet : request.getParameter() returns a parameter from the query string in a POST request
body: <p>I'm currently developing a Servlet that runs under Glassfish 4.
  I implemented the <code>doPost()</code> method and I need to ensure that the parameters are passed using the <code>POST</code> body, and not in the query string.</p>
  
  <p>I wrote a test implementation to check it:</p>
  
  <pre><code>protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  
      String name = request.getParameter("name");
  
      response.getOutputStream().print(name);
  }
  </code></pre>
  
  <p>If I call my page with <code>POST</code> with this url:</p>
  
  <pre><code>http://localhost:8080/myservlet/testservlet
  </code></pre>
  
  <p>and pass <code>name=Nico</code> into the post body, the value <em>Nico</em> is returned, and it's okay.</p>
  
  <p>Now if I call it this way:</p>
  
  <pre><code>http://localhost:8080/myservlet/testservlet?name=Robert
  </code></pre>
  
  <p>and I still pass <code>name=Nico</code> in the <code>POST</code> body, <em>Robert</em> is returned, and the <em>name=Nico</em> is ignored.</p>
  
  <p>I just would like to avoid parameters to be passed in the URL.<br>
  Is there a way to explicitly retrieve parameters from the <code>POST</code> body instead of body + query string?</p>