一只会飞的白菜
2017-11-23 08:20
采纳率: 15.4%
浏览 2.8k
已采纳

session 放了一个List<Map<String,Object>> 怎样取值

     @RequestMapping("/usercentersava.xhtml")
    @ResponseBody
    public List<Map<String,Object>> sava(HttpServletRequest request) throws IllegalAccessException {
        UsercenterEntity usercenter=new UsercenterEntity();

        List<Map<String,Object>> list= (List<Map<String, Object>>) request.getSession().getAttribute("usercenter");

        for (Map<String, Object> stringObjectMap : list) {
            System.out.println(stringObjectMap);
        }

        return baseServiceUtil.query4list(usercenter);
    }
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • 已采纳

    仿照下面代码:****

        Map map = new HashMap<String, Object>();
    map.put("1", "fds");
    map.put("2", "valu");
    List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
    list.add(map);
    for (Map<String, Object> m : list)
    {
      for (String k : m.keySet())
      {
        System.out.println(k + " : " + m.get(k));
      }
    
    }
    
    1 打赏 评论

相关推荐 更多相似问题