Ext请求过程中jsonArray的使用方式
/*** * 取得用户组 * 根据不同的用户组类型取得用户组 * @param request request * @param response response */ @RequestMapping(value = "/getUserGroup") public void getUserGroup(HttpServletRequest request, HttpServletResponse response) { setSysVersion(request); List<Map<String, Object>> list = null; String groupType = request.getParameter("groupType"); String groupValue = request.getParameter("groupValue"); if (groupType != null && groupValue != null) { list = applicationDao.getUserGroup(groupType,groupValue); } else if (groupType != null) { list = applicationDao.getUserGroup(groupType); } JSONArray jsonObj = JSONArray.fromObject(list); try { //向前台写数据 response.getWriter().write(jsonObj.toString()); } catch (IOException e) { logger.error("com.ecm.huawei.smartcare.subscriberAnalysis.getUserGroup" + e); } }
Ext.Ajax.request({url: userGroupUrl,params:{groupType:this.getType(),groupValue:inputValue},async : false,success: function(response) {if(response.responseText == ""){isExist = false;}else if(Ext.util.JSON.decode(response.responseText)[0].SUBGROUP == inputValue){isExist = true;}else{isExist = false;}}})