On Mon, 2 Sep 2002, VTR Ravi Kumar wrote:

> java.util.Vector$1@659374c2
> false
> No of sessions=0
> Session id com.tagtraum.jo.JoSession@6b9774c2
>
> why does it return false

HttpSessionContext was deprecated a while ago.

For security reasons, it's best to implement the logic you're looking for
yourself, using perhaps a session listener that increases a value in
application scope on session creation and decreases it on termination.

E.g. (typed here and untested, but it's the general idea) -

  public class Counter implements HttpSessionListener {

    public synchronized void sessionCreated(HttpSessionEvent se) {
      ServletContext sc = se.getSession().getServletContext();
      int count = ((Integer) sc.getAttribute("count")).intValue();
      sc.setAttribute("count", new Integer(count++));
    }

    public synchronized void sessionDestroyed(HttpSessionEvent se) {
      ServletContext sc = se.getSession().getServletContext();
      int count = ((Integer) sc.getAttribute("count")).intValue();
      sc.setAttribute("count", new Integer(count--));
    }

  }

--
Shawn Bayern
"JSTL in Action"   http://www.jstlbook.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to