$.ajax({ url: "${ctx}/selfprogram/selfProgram/showParam?paramIds="+pmIds, type: "get", dataType:"json", success: function (data) { var obj = eval(data); var str = ""; var exParamerIds = parent.parent.$("#exParamerIds").val(); var eachParamer = exParamerIds.substring(0,exParamerIds.length-1).split(","); str = str+"主键+序号参数名称参数分类单位排序" +""; for (var i = 0; i < eachParamer.length; i++) { /*当返回数据id与隐藏域数据一致时,将隐藏域对应的排序给页面展示*/ var index = eachParamer[i].indexOf(":"); var praId = eachParamer[i].substring(0,index); var querySort = eachParamer[i].charAt(eachParamer[i].length - 1); str = str +""+querySort +""+obj[i].id +""+obj[i].name +""+obj[i].typeValue +""+obj[i].unitValue +"上移 下移"; } str = str+""; parent.parent.$("#contentTable2").html(str); parent.parent.initTableCheckbox(parent.parent.$('#contentTable2 thead tr'),parent.parent.$('#contentTable2 tbody tr')); parent.parent.$.jBox.close(true); }
后台
public static void outResult(HttpServletResponse response, Object object) { response.setContentType("text/plain;charset=UTF-8"); response.setHeader("Cache-Control", "no-cache"); PrintWriter out = null; try { out = response.getWriter(); } catch (Exception e) { e.printStackTrace(); } String str = JsonMapper.toJsonString(object); out.print(str); out.flush(); out.close(); }
@RequiresPermissions("selfprogram:selfProgram:view") @RequestMapping(value = "showParam") public String showParam(String paramIds,HttpServletResponse response) { ListparametersList = new ArrayList (); ...... JsonMapper.toJsonString(parametersList); outResult(response,parametersList); return null; }