title: Getting 500 internal server when using 'post' in ajax request
body: <p>I am working with JSP and ajax using jquery in my sample project. I am sending json data from  client to  server and in response I am getting another json from server. Everything works fine if I use 'get' method. If I use 'post' then I am getting 500 Internal server error.
  My sample client side code is </p>
  
  <pre><code>jQuery.ajax({
      url : "server.jsp",
      type : "POST",
      data:{req_data:JSON.stringify({"user_name":UserName,"url":URL})},
      async : false,
      dataType: 'json',
      contentType : "application/json; charset=utf-8",
      success : function(data) {
        console.log(data);
      },
      error : function() {
        console.log("error");
      }
  </code></pre>
  
  <p>And my sample jsp server side code is</p>
  
  <pre><code>&lt;%@ page import="java.io.PrintWriter"%&gt;
  &lt;%@ page import="org.json.simple.JSONObject"%&gt;
  &lt;%@ page import="org.json.simple.JSONValue"%&gt;
  
  request.setCharacterEncoding("utf8");
  response.setContentType("application/json");
  PrintWriter outt = response.getWriter();
  
  JSONObject reqjsonObj = (JSONObject)JSONValue.parse(request.getParameter("req_data"));
  String uname=reqjsonObj.get("user_name").toString();
  String url=reqjsonObj.get("url").toString();
  JSONObject resjsonObj = new JSONObject();
  resjsonObj.put("name",uname);
  resjsonObj.put("url",url);
  out.print(resjsonObj);
  out.flush();
  out.close();
  </code></pre>
  
  <p>Everything works fine if I use 'GET' instead of 'POST' in ajax request. What is the possible mistake that I am making here?</p>