后台向前台传输map数据,怎么遍历
springmvc吧
全部回复
仅看楼主
level 1
DIVINEXIAO 楼主
具体数据如下
后台控制器代码
@RequestMapping("/test")
public String test(HttpServletRequest req,HttpServletResponse response){
//查询人次
Map<String, Object> mapone= new HashMap<String, Object>();
Map<String, Integer> map2=new HashMap<String, Integer>();
map2.put("zs",10);
map2.put("ls",20);
Map<String, Integer> map3=new HashMap<String, Integer>();
map3.put("ww",30);
map3.put("zl",40);
mapone.put("one",map2);
mapone.put("two",map3);
req.setAttribute("mapone", mapone);
return "/test";
}
前台js进行遍历map。但是在页面上我是用
var mapone='${mapone}';
进行取值,这个时候数据类型变成了String(我是通过typeOf(mapone)看到了)。这个时候我该怎么遍历。求大神解答
2017年06月28日 10点06分 1
level 1
DIVINEXIAO 楼主
好着急。大神路过请进来解答
2017年06月28日 10点06分 2
level 1
表示不会
2017年10月12日 13点10分 4
level 2
方法上加responsebody
2017年10月15日 08点10分 5
level 1
前台的话使用c标签的foreach
2017年11月08日 06点11分 6
1