下面的代码告诉你返回的时候应该如何选择(返回的是数组还是对象)

来源:互联网 发布:点对点网络测速工具 编辑:程序博客网 时间:2024/05/02 00:41
JsonConfig config = new JsonConfig();  config.setExcludes(new String[]{"books","booktype"});JSONArray array = new JSONArray();  //JSONObject jsonObject = new JSONObject(); //String t = jsonObject.fromObject(booktypetop, config).toString(); String t = array.fromObject(booktypestop, config).toString(); ServletActionContext.getResponse().setContentType("text/html;charset=utf-8");ServletActionContext.getResponse().getWriter().print(t); 


使用哪个对象就是传回去上面数据。

0 0