Servelt返回数组类型json数据

来源:互联网 发布:Apple Watch解锁mac 编辑:程序博客网 时间:2024/05/16 05:30
  • jar已经上传了
    servlet代码
 ArrayList<Integer> arrayList=new ArrayList<>();         response.setContentType("application/x-json");         PrintWriter print=response.getWriter();         JSONArray jsonArray = JSONArray.fromObject(arrayList);  //重点         print.print(jsonArray);          print.flush();         print.close();
0 0
原创粉丝点击