File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sessions

 
Aaron O'Brien
Ranch Hand
Posts: 89
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am a little confused about sessions so if anyone has some info to share please pass it on!
Thanks in advance!
SCJP2
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
are you referring to session beans?? or.. what are you confused about?
cheers
 
Long Huynh
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Aaron,
I'm assuming that you are referring to Session EJBs, since this forum is for J2EE and EJB. Well, from the top of my head, i can tell you that there are two main EJBs Session and Entity. Now, if we are taling about Session EJBs ( and not just a regular 'Session Bean'), then there are two other parts. There is the Stateful and Stateless Session EJBs. Basically, the Statefull has more overhead than the Stateless, over the network , because it has to remember states ( or carry data) as the client walk through certain webpages from the page that implicitly invoked or created the Stateful Session. Well, if you are asking when is best to use what? Well, ideally we would want so use stateless for all our needs. However, the stateless is good when you want to say invoke another page or update the current page with new data base on internal infomation or static links etc. But, if let say you need to retrieve data from the client from a series of say, 5 pages and then return the result base on what the user have given you. Well, the Statefull bean is useful here to help remember what the use had entered through those 5 pages, before you know what data to retrieve from the DB tier and calculate and return the results. However, this Statefull bean have to keep its states in the EJB pool (sorta like the String pool ) until it is no longer needed, and its states will reset for another use. If you want to know why we should use EJB Session instead of say the regular session, that's sorta another topic. But if you read up on EJB designs, you will notice that there is something like a regular session bean calling the EJB Session Beans or Entity Beans. Anyways, I hope this short and unprofessional introduction to EJB session was a little helpful.

Cheers,
Long Aaron Huynh
SCJP2
[ July 22, 2002: Message edited by: Long Huynh ]
 
jesse harris
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
.....and if you are asking about HttpSessions, they are a way for you to persist objects between servlet requests. a session is just a hashtable of objects kept by the app server for retrival. Very simple and useful as Servlets are shared by all requests that come in(usually), so thier class level variables are essentially static.
 
Aaron O'Brien
Ranch Hand
Posts: 89
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow,
That was pretty helpful! Thanks alot...maybe any of you would have some URLs that would be useful for me to get farther in depth with this subject?! Thanks again!
Aaron SCJP2
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic