ajax 数据回传

response.getWriter().print(reval > 0 ? true : false);

//===========================

Object[] str = new Object[2];

str[0] = validateId;
// 转出插件需要的
str[1] = isExist == true ? false : true;
JSONArray array = JSONArray.fromObject(str);
out.print(array.toString());
out.close();

//===========================

jsonMap.put("result", reval > 0 ? true : false);
JSONObject jsonobj = JSONObject.fromObject(jsonMap);
Struts2Utils.renderHtml(jsonobj.toString(), "encoding:GBK");

  

原文地址:https://www.cnblogs.com/fxfly/p/5067056.html