File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Android Security Essentials Live Lessons this week in the Android 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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: list all session variables
 
Similar Threads
Thread safety in spring web application
session vs class variables
Regarding usage of scriplet variable in EL
How to display all session variables
All set session Variables List