[jboss-user] [EJB/JBoss] - EJB3Trail question about stateful bean
zzeuxis
do-not-reply at jboss.com
Thu Nov 30 05:00:53 EST 2006
In JBoss 4.0.5 GA (ejb3 profile)
I consider the following code in the EJBTrail example (inside the jsp calculator page that call a Stateful Calculator bean):
| Calculator cal =
| (Calculator) session.getAttribute("sfsb_cal");
| if (cal == null) {
| try {
| InitialContext ctx = new InitialContext();
| cal = (Calculator) ctx.lookup(
| "StatefulCalculator/remote");
| session.setAttribute ("sfsb_cal", cal);
| } catch (Exception e) {
| e.printStackTrace ();
| }
| }
If I call a jndi lookup each time the page is rendered : I change :
Calculator cal =
| (Calculator) session.getAttribute("sfsb_cal");
to
Calculator cal = null;
Then I get a new Stateful bean each time the page is rendered ... Isn't that contradictory with the fact that one Stateful bean should created by session ?
I think there is something that I dont understand here ... I'll be glad to get some pointers here ;-)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3989973#3989973
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3989973
More information about the jboss-user
mailing list