首页 > 代码库 > Servlet处理Json请求数据包

Servlet处理Json请求数据包

request.setCharacterEncoding(‘UTF-8‘); response.setContentType(‘text/html;charset=UTF-8‘);String acceptjson = ‘‘; BufferedReader br = new BufferedReader(new InputStreamReader( (ServletInputStream)request.getInputStream(), ‘utf-8‘));StringBuffer sb = new StringBuffer(‘‘);String temp; while ((temp = br.readLine()) != null){     sb.append(temp); }br.close();acceptjson = sb.toString(); 

 

Servlet处理Json请求数据包