title: How to send data to Servlet from Android by doPost
body: <p>I send data to servlet from HTML, it will work successfully.</p>
  
  <p>But from Android, it will pass to next <strong>Intent</strong>. Servlet will show <strong>"NULL"</strong>, had no data.</p>
  
  <p>Could anyone please tell me where I am wrong? Thank you!</p>
  
  <p><strong>Servlet Code:</strong>    </p>
  
  <pre><code>public class SocialServlet extends HttpServlet {
      @Override 
      protected void doGet(HttpServletRequest request,HttpServletResponse response) 
                          throws IOException,ServletException{
              this.doPost(request,response);
      }
      @Override
          protected void doPost(HttpServletRequest request, HttpServletResponse response)
                  throws ServletException, IOException {
  
              PrintWriter out = response.getWriter(); 
                  String json_array = request.getParameter("array");
                  out.println(json_array);
      }
  }
  </code></pre>
  
  <p><strong>Android Code:</strong> </p>
  
  <pre><code>DefaultHttpClient httpClient = new DefaultHttpClient(); 
  HttpPost httpPost = new HttpPost("http://192.168.1.103:8080/social/social.do");
  List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;(); 
  params.add(new BasicNameValuePair("array", "teststring")); 
  httpPost.setEntity(new UrlEncodedFormEntity(params)); 
  HttpResponse httpResponse = httpClient.execute(httpPost); 
  </code></pre>