1、JS中上传(前台) var bke057s = []; for (var i = 0; rows.length > i; i++) { bke057s.push(rows[i].bke057); } bke057s = bke057s.join(','); controller层接收(后台) String[] bke057Array = request.getParameter("bke057s").split(",");//数组 for (String bke057 : bke057Array) { } 2、JS中上传(前台) function cbdCzxxQr(rows) { $.ajax({ type: "post", url: "${basePath}/ydybCz/jydSjCz", data : {czxx:mini.encode(rows)}, dataType: "json", cache: false, success: function (text) { mini.alert(text.result.data); cbdCzXxGrid.reload(); }, error: function (text) { mini.alert(text.result.message); } }); } controller层接收(后台) String czxx = request.getParameter("czxx");//数据 List<Kd21Dto> kd21DtoList = JsonUtils.toList(czxx,Kd21Dto.class); 3、url传参(包括传输汉字) var url = "${basePath}/grjbxxcx/downcbxx?aab001=" + aab001 +"&aac147=" + aac147+ "&aab004=" +queryData.aab004 +"&aae001=" + queryData.aae001 + "&aac008=" + queryData.aac008 + "&aie146=5"; window.open(encodeURI(encodeURI(url))); controller接收时: import java.net.URLDecoder; String aab004 = URLDecoder.decode(cxjmcbxxDto.getAab004() , "UTF-8"); 4、后台向前台传递参数 public ModelAndView grjbxxcx() { String aaa027 = Escape.subString(HnybContextHelper.getAaa027()); ModelAndView mv = new ModelAndView("/hnpages/cxjmcbgl/jbxx/grjbxxcx"); mv.addObject("aaa027", aaa027); return mv; } 前台接收: <%String aaa027 = (String)request.getAttribute("aaa027");%> --放在head上面即可
参数传递
最新推荐文章于 2024-11-08 14:58:24 发布