File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes HTTPSession  Vs  Statefull Session Bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "HTTPSession  Vs  Statefull Session Bean" Watch "HTTPSession  Vs  Statefull Session Bean" New topic

HTTPSession Vs Statefull Session Bean

kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1432
When we go for Statefull Session Bean instead of HTTPSession ?
Ajith George
Ranch Hand

Joined: Dec 22, 2005
Posts: 109
Actually they are entirely different. We use statefulle session ejb's when we want to store any kind of sate temperorly. This will have scope same to the scope of the object of that bean. But HTTPSession is having scope only on each session id made by the client. Moreover data carrying capability is limited. If you store too much data on Httpsesion, your application definitly will become slow.

Hope this will give you some better idea

SCJP 1.4, Brainbench
LinkedIn - Blog
Sergio Berna

Joined: May 02, 2006
Posts: 2
As i see it they are both different things. You use httpSessions to store temporary data between page calls and you use an stateful ejb bean to use ejb beans that need some kind of state.

I would not join them both together by inserting the remote interface into the http session. You are bound to have a lot of problems with clustering and you would be limited to in memory session representation. If you need to store something for the session duration i would go for entity ejb and would only store the reference to the ejb pkid into the session.

Sergio Berna<br />Open-VA, a fully accessible open source Validation Authority <br /><a href="" target="_blank" rel="nofollow"></a>
I agree. Here's the link:
subject: HTTPSession Vs Statefull Session Bean
It's not a secret anymore!