Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Servlets and the fly likes list all session variables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "list all session variables" Watch "list all session variables" New topic
Author

list all session variables

scottie zman
Ranch Hand

Joined: Aug 08, 2001
Posts: 40
Can someone post some code to loop through all session variables and display their values?
thanks
Zman
Manjunath Reddy
Ranch Hand

Joined: Jul 26, 2001
Posts: 60
Enumeration e = session.getAttributeNames();
while ( e.hasMoreElements() )
{
String key = (String)e.nextElement();
out.println( key + " = " + session.getAttribute( key ) + " <br>" );
}
mpr
scottie zman
Ranch Hand

Joined: Aug 08, 2001
Posts: 40
thanks a bazillion.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: list all session variables