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/>"); }
}