The code snippet below used Enumeration to get all the values stored in the session.

Java Code:
HttpSession theSession = req.getSession();
Object obj = theSession.getAttribute( "mySession" );
Enumeration attributeNames = theSession.getAttributeNames();
while( attributeNames.hasMoreElements() ) {
String attributeName = (String) attributeNames.nextElement();
obj = theSession.getAttribute( attributeName );
pw.println( "<BR>" + attributeName + " = " + obj );
}