获取session中的所有值并打印

时间:2021-08-20 15:15:05   收藏:0   阅读:12

问题:在debugger中下拉框数据获取不到,主要原因session中的id为空,故想打印session中所有值看看

 HttpSession session = request.getSession();
        Enumeration enumeration = session.getAttributeNames();
        while (enumeration.hasMoreElements()){
            String name = enumeration.nextElement().toString();
            Object value = request.getSession().getAttribute(name);
            System.out.println(name+":"+value);
        }

原文:https://www.cnblogs.com/polatu/p/15166157.html

评论(0)
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!