• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Jj Roberts
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Himai Minh
  • Carey Brown
  • salvin francis

Sessions in EJB and JSP/Servlets

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
Saloon Keeper
Posts: 22788
153
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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" (?)
 
Manjunath Subramanian
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 440
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic