Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing a Stateful Session Bean to track an user's session
    text
    copied!<p>it's my first question here and I hope that I'm doing it right.</p> <p>I need to work on a Java EE project, so, before starting, I'm trying to do something simple and see if I can do that.</p> <p>I'm stuck with <em>Stateful Session Beans</em>.</p> <p>Here's the question : How can I use a <em>SFSB</em> to track an user's session? All the examples that I saw, ended up in "putting" the <em>SFSB</em> into a <em>HttpSession</em> attribute. But I don't understand why! I mean, if the bean is STATEFUL, why do I have to use the <em>HttpSession</em> to keep it?</p> <p>Isn't an EJB Container's task to return the right <em>SFSB</em> to the client?</p> <p>I've tried with a simple counter bean. Without using the session, two different browsers have the same counter bean (clicking on "increment" changed the value for both of them). Using session, I have two different values, each for every browser (clicking on "increment" on Firefox, added one just to Firefox's bean).</p> <p>But my teacher told that a <em>SFSB</em> keeps the "conversational state with a client", so why it doesn't just work without using a <em>HttpSession</em> ?</p> <p>If I understood correctly , isn't using <em>HttpSession</em> with a <em>SFSB</em> the same of doing it with a <em>SLSB</em> instead?</p> <p>I hope that my question(s) is clear and that my English is not that poor!</p> <p>EDIT : I'm working on a login system. Everything goes fine and after completing the login it takes me to a profile page that show user's data. But reloading the page makes my data disappear! I've tried adding <em>HttpSession</em> while logging but doing in this way makes the data stay even after the logout!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload