The Artima Developer Community
Sponsored Link

Java Answers Forum
Stateful and Stateless Session Beans

1 reply on 1 page. Most recent reply: Aug 28, 2003 5:05 AM by Senthoorkumaran Punniamoorthy

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
swan

Posts: 7
Nickname: swan
Registered: Aug, 2003

Stateful and Stateless Session Beans Posted: Aug 27, 2003 9:40 PM
Reply to this message Reply
Advertisement
Hi,

I want an example of, how the a stateful Session Bean maintians the conversational state between client calls ?

I would like to quote a simple example. Suppose i access the stateful session bean in my jsp page. I first create the bean, then i call a method on the bean to set some variable. Now i go to the next jsp page. In the new jsp page, i want to read the session bean's variable which i have set in the previous jsp page. How can i achieve this ?

Someone told me that i need to keep the reference of hte bean's remote object in my HttpSession and access it in the next page.

But, i suspect, this can be done with stateless session bean also. If i use a stateless session bean in one of my jsp page, set some variable of the bean, put the bean's reference in my http session and try to access the bean in a new jsp page using the reference i have stored in the session. Can i do this ?

If yes, then how can i differentiate between the stateful and stateless session beans ?

What are the other aspects in which these two beans differ ?


Senthoorkumaran Punniamoorthy

Posts: 335
Nickname: senthoor
Registered: Mar, 2002

Re: Stateful and Stateless Session Beans Posted: Aug 28, 2003 5:05 AM
Reply to this message Reply
If you want to maintain conversational state between client calls I think its best to use Statefull Session Beans.

When it comes to Statefull session beans there will be one-to-one mapping between number of clients available and number of bean instances available.

But when it comes to Stateless Session beans they might be re-used by the container to service the clients. So they can't hold the client states.

I think the reason you suspect that the same thing can be achieved by both Statefull and Stateless session beans are may be because you are just testing with one client (Browser or a client program). May be both behaves similarly when there is one client!!!

Flat View: This topic has 1 reply on 1 page
Topic: Improving Applet Performance Previous Topic   Next Topic Topic: please please help - palindrome program

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use