File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Sessions in EJB and JSP/Servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Sessions in EJB and JSP/Servlets" Watch "Sessions in EJB and JSP/Servlets" New topic
Author

Sessions in EJB and JSP/Servlets

kiran mahavir
Ranch Hand

Joined: Jan 09, 2001
Posts: 35
Hello all,
may i know the difference between the sessions in ejb and in JSP/Servlets. Are they used for same purpose ? If not under what circumstanes do we go for them.
Thanking in advance
with regards
kanth
Manjunath Subramanian
Ranch Hand

Joined: Jul 18, 2001
Posts: 236

Hi Kiran,
Your question co-incides with java.sun.com's
"QUESTION OF THE WEEK".
http://developer.java.sun.com/developer/qow/index.jsp
But i would appreciate if somebody throws more light on this!!
thanks,
Manjunath
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16141
    
  21

A "session ejb" is NOT a session in the sense of being a centralized place for short-term data persistency the way a servlet/JSP session is. In fact, the Stateless Session EJB has no data persistency at all, while Entity EJBs are permanently persistent.
In other words, as far as user sessions are concerned, Sun would have been better off naming them "gummi-bear EJBs". I think their intent had actually been to mean "EJBs used BY a Session" (?)


Customer surveys are for companies who didn't pay proper attention to begin with.
Manjunath Subramanian
Ranch Hand

Joined: Jul 18, 2001
Posts: 236

Hi Tim,
I get only this point
The Stateless Session EJB has no data persistency at
all, while Entity EJBs are permanently persistent.

but not much regarding all the other points.
I have a vague idea about sessions w.r.t EJB's and the web
components,but i am not able to get to the exact difference
between them.
Can you explain this point a little more Tim?
thanks
Manjunath
ruilin yang
Ranch Hand

Joined: Feb 25, 2001
Posts: 334
My understanding is that in Servlet/JSP you can put data in the session object to persist the info for a session.
However, in EJB, if you use a stateless session bean you will not persist info when you jump between methods/pages within a log-in session.
Please comment more.
ranga 786
Greenhorn

Joined: Aug 28, 2001
Posts: 4
in case of SessionBeans a well defined life cycle is there and the containere provides a lot of services which a jsp /servlet cant get from the webserver.
Matt Midcap
Sheriff

Joined: Jan 07, 1999
Posts: 440
"ranga 786",
Thank you for your input on this subject.
Also, the Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.
Thanks.


Best Regards,<br />Matt Midcap
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sessions in EJB and JSP/Servlets