• Post Reply Bookmark Topic Watch Topic
  • New Topic

session

 
Jackie Wang
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone tell me that how I can grab all the session object, attribute in a jsp page or in a java page which it is forwarding to? thanks
 
Blake Minghelli
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you need to check out HttpSession.getAttributeNames() and HttpSession.getAttribute() in the servlet api.
 
Jackie Wang
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
will that be a enumeration or how do i know how many seesion object are there? thanks!
 
Chris Smith
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read the API docs. Yes, that returns an enumeration. There's no simple way to determine the number of them, except to walk through it and count.
Chris
 
Jackie Wang
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks chris.
so which method should i use? should i find the method in object? thanks!
 
Anthony Smith
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<%
try
{
for (Enumeration a = session.getAttributeNames() ; a.hasMoreElements()
}
catch (Exception e)
{
System.out.println("Problem trying to set request variables: " + e);
}
%>
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!