$.ajax({//提交数据 url:'http://localhost:8080/Order/Change_PS?', //提交地址 type:"POST", data:{"CN_USER_ID":"oldPassword"}, //提交数据 contentType:"application/json", //dataType:"json", //返回类型 success:function(result){ //成功回调 }, error: function(result){ } });
1查看ajax中的contenType是否是
application/json
是的话取值使用流来获取
BufferedReader br = new BufferedReader(new InputStreamReader(request.getInputStream(),"utf-8")); StringBuffer bf =new StringBuffer(); String temp ; while ((temp = br.readLine() )!= null){ bf.append(temp); } br.close(); System.out.println(bf.toString());