You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by dulipalla narayana rao <dv...@rediffmail.com> on 2003/07/25 08:52:53 UTC

Small Query

Hi,
    I am Narayna Rao,  I am a fresh graduate who is learning 
servlets and JSP.  I faced a small problem in JSP.  In Orierly 
book they written that we can find out the number of session are 
active for a given application using following code.

     HttpSessionContext hsc=session.getSessionContext();
     out.println(hsc+"<br>SessionId"+session.getId()+"<br>");
     Enumeration e= hsc.getIds();
     out.println(e);
     //out.println("<br>"+e.nextElement());
     out.println("Session ID's");
     while(e.hasMoreElements())
     {
         out.println("Session ID's"+(String)e.nextElement());
     }

But I am not geting not a Single Session Id, even though there are 
3 session are active in Manager list of Tomcat.  Plz let me know 
why this is happening.

Actually there is no body to help me in this context, and i have 
only one book with me.

Please Help me.

Yours Sincerly,
Rao
___________________________________________________
Download the hottest & happening ringtones here!
OR SMS: Top tone to 7333
Click here now: 
http://sms.rediff.com/cgi-bin/ringtone/ringhome.pl



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: Small Query

Posted by Osamu Hashimoto <os...@yha.att.ne.jp>.



 Hello, from Japan.
 
 You must write like this. Try it.

 HttpSessionContext hsc=session.getSessionContext();
 out.println(hsc+"SessionId"+session.getId()+"");
 Enumeration e= hsc.getIds();
 out.println(e);
//out.println("
//"+e.nextElement());
 out.println("Session ID's");
 while(e.hasMoreElements())
 {
 out.println("Session ID's"+(String)e.nextElement());
 }


 Your code shown below is bit mistaken.
 

>  HttpSessionContext hsc=session.getSessionContext();
>  out.println(hsc+"
>  SessionId"+session.getId()+"");
>  Enumeration e= hsc.getIds();
>  out.println(e);
> //out.println("
>  "+e.nextElement());
>  out.println("Session ID's");
>  while(e.hasMoreElements())
>  {
>  out.println("Session ID's"+(String)e.nextElement());
>  }

----- Original Message ----- 
From: "dulipalla narayana rao" <dv...@rediffmail.com>
Subject: Small Query


> Hi,
>     I am Narayna Rao,  I am a fresh graduate who is learning 
> servlets and JSP.  I faced a small problem in JSP.  In Orierly 
> book they written that we can find out the number of session are 
> active for a given application using following code.
> 
>      HttpSessionContext hsc=session.getSessionContext();
>      out.println(hsc+"<br>SessionId"+session.getId()+"<br>");
>      Enumeration e= hsc.getIds();
>      out.println(e);
>      //out.println("<br>"+e.nextElement());
>      out.println("Session ID's");
>      while(e.hasMoreElements())
>      {
>          out.println("Session ID's"+(String)e.nextElement());
>      }
> 
> But I am not geting not a Single Session Id, even though there are 
> 3 session are active in Manager list of Tomcat.  Plz let me know 
> why this is happening.
> 
> Actually there is no body to help me in this context, and i have 
> only one book with me.
> 
> Please Help me.
> 
> Yours Sincerly,
> Rao


    Osamu Hashimoto

    osm@yha.att.ne.jp

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org