Personally I'm not really fond of using the MVC-terminology to describe this scenario 
of EJB. Also I add a layer of Entities behind the Session. In this case (using 
MVC-terminology) the Entity is the Model, the Session is the Controller, the Servlet 
is the Renderer (responsible for Presentation) and the Browser is the View.

To answer your question. The interface javax.ejb.Handle is required to be implemented 
as an serializable class by EJB container and can be accessed through the 
EJBObject.getHandle() method. This can used as a value  in the 
HttpSession.putValue()-method. It can also be serialized and sent to the client side 
as a base64-encoded String if your appserver doesn't support session-tracking etc. etc.
Personally the only thing I use the HttpSession.putValue()-method for is to save the 
handle to the session. The SessionBean is used for all session-state. Also only the 
SessionBean manipulates the entities, never the Servlet.

-----Original Message-----
From:   Mike [SMTP:[EMAIL PROTECTED]]
Sent:   Wednesday, March 24, 1999 6:20 PM
To:     [EMAIL PROTECTED]
Subject:        Servlets -> EJB Session Persistence

My question is how do I maintain session state when using HTML, Servlets and EJB's?

Scenario:
1) An HTML client(view) invokes a servlet. 2) The servlet(controller) calls an EJB 
Session bean (Model). 3)The Servlet sends a response back to the client and 
terminates. The HTML client invokes the servlet to do something
else, and so on.

Question:
1) How do you maintain a reference to the Session Bean once the Servlet destroy() 
method is called?

===========================================================================
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".

�������������������������o 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