post 请求 java接收处理得到请求数据

public void doPost(HttpServletRequest request, HttpServletResponse response)  
            throws ServletException, IOException { 
				  StringBuffer sb = new StringBuffer() ; 
				  InputStream is = request.getInputStream(); 
				  InputStreamReader isr = new InputStreamReader(is);   
				  BufferedReader br = new BufferedReader(isr); 
				  String s = "" ; 
				  while((s=br.readLine())!=null){ 
				  sb.append(s) ; 
				  } 
				  String result =sb.toString(); 


/**********************响应*****************************/
		response.setContentType("text/html;charset=utf-8");
		response.setCharacterEncoding("utf-8");
		response.getWriter().append(jsonstr);//jsonstr返回给请求的值
}

你可能感兴趣的:(post 请求 java接收处理得到请求数据)