javaweb查看后台session和request所有的值

遍历session

@RequestMapping(value ="/test2")
    public String upload2( HttpSession session) {
        Enumeration e = session.getAttributeNames();
while (e.hasMoreElements()) { String sessionName = (String) e.nextElement(); System.out.println("\nsession item name=" + sessionName); System.out.println("\nsession item value=" + request.getSession().getAttribute(sessionName)); } return "test"; }

 

遍历request

@RequestMapping(value ="/test2")
    public String upload2( HttpRequest request) {

Enumeration e = request.getAttributeNames();
while (e.hasMoreElements()) {
    String sessionName = (String) e.nextElement();
    System.out.print("\nrequest item name=" + sessionName+"<br/>");
    System.out.print("\nrequest item value=" + request.getAttribute(sessionName)+"<br/>");
}
}

 

posted @ 2016-02-02 16:48  渚之汐酱  阅读(1945)  评论(0编辑  收藏  举报