Hi Srinivas,

You can achieve this as follows:

1) In your base servlet create the bean instance of the Stateful session
bean. (i.e., get the home interface by JNDI methods and get the remote
interface.

         empproj.ICustomerHome m_Customer_ejbhome = null;
      empproj.ICustomer m_Customer_ejbremote = null;
      javax.ejb.Handle CustomerHandle = null;

         InitialContext icContextObj = new InitialContext();
      Object objRef = icContextObj.lookup("empproj/Customer");
      m_Customer_ejbhome =
(ICustomerHome)PortableRemoteObject.narrow(objRef, ICustomerHome.class);

2) Give the handle for the Session Bean.

        CustomerHandle = m_Customer_ejbremote.getHandle();

3) Keep the handle in the HttpSession.

        session.putValue("Customer_Handle", CustomerHandle);

4) Use the same handle to get the same instance from the pool.

        CustomerHandle = ( javax.ejb.Handle)
session.getValue("Customer_Handle");

Hope this helps....

Thanks & Regards,
Srinivasa Rao Chintala (TCS)
GE Capital Fleet Services
GECFS Global Application Framework Architecture
3 Capital Drive, Eden Prairie
Minneapolis,  MN   55344
Ph:  952 - 828 - 1476  (Off)
       952 - 942 - 6818  Ext: 1523 (Resi)
       * 672 - 1476  (Dial Comm)


-----Original Message-----
From: Sreenivasa R V [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 21, 2000 12:49 AM
To: [EMAIL PROTECTED]
Subject: Session Management using Stateful Session Beans


Hi Guyz,
    we are developing a web applicaton using servlet, jsp and EJB.we
want to implement session management using Stateful Session Bean as
follows.

1. All the user requests are routed through one common Servlet
(BaseServlet). i.e All our application servlets will be extending this
BaseServlet.
2. In the BaseServlet, A Stateful session bean is used for session
management. The problem is how do i ensure that same bean is being
called when the same user requests for second time.

I have browsed the archieves but there is no information on this. I do
not want to use HttpSession of Servlet Engine.
Without implementing this functionality, we cannot move further in our
application development. So all your responses will be greatly
appreciated.

Thanx in advance,
Sreenivas R.V.

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to