The session object has a method named getAttributeNames(), which returns an enumeration of the names of all objects bound to the session. You can loop through the enumerated names and retrieve the session values with session.getAttribute(name):
Enumeration names = session.getAttributeNames();
while (names.hasMoreElements()) {
String name = (String) names.nextElement();
Object value = session.getAttribute(name);
}
Here is an example of the technique that uses a table to print the retrieved attributes:
------------------
Phil Hanna
Sun Certified Programmer for the
Java 2 Platform
Author of :
JSP: The Complete Reference Instant Java Servlets Website:
http://www.philhanna.com
Phil Hanna<BR>Sun Certified Programmer for the Java 2 Platform<BR>Author of :<BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0072127686/electricporkchop/107-3548162-1137317" TARGET=_blank rel="nofollow">JSP: The Complete Reference</A><BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0072124253/electricporkchop/107-3548162-1137317" TARGET=_blank rel="nofollow">Instant Java Servlets</A>