Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Passing the same stateful session bean across JSF pages  RSS feed

 
Venus Ong
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello to everyone at Java Ranch!

I am a new user here and I have a question on how can I pass the same stateful session bean across JSF pages.

It would be great if you could post some suggestions on how I can implement this.

By the way, I am using EJB 3.0 and weblogic.

Thank you so much in advance
 
Venus Ong
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello again, I have read some of the forum's post on putting the stateful session bean's reference into the HttpSession scope.

But I am still unsure of what reference should I put into the scope.

Does it have something to do with setting the remote interface of my bean to the initial context? Or the method that gets the initial context?

Client code for linking the context to my remote interface.


Method for getInitialContext:


P.S. StatefulMr is my Stateful Bean's Remote Interface.

Once again, thank you and I look forward to any reply
 
Tim Holloway
Bartender
Posts: 18704
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, actually, in EJB3, the whole idea of remote EJBs is mostly history. Although there's still occasion where you need a bean external to the webserver, it was always more the exception than the rule, so now the whole architecture has gotten away from that, and from the need for explicit JNDI code.

If you have a legacy need, do the same thing any other J2EE app would to keep hold of an EJB between requests: get its handle, store the handle in a session object (which can be a JSF session bean or not, as you prefer). Then when you need it, dereference the handle.

If this is a new app, grab the docs on EJB3 and learn the joys of the @Stateful annotation. There are quite a few good tutorials on EJB3 these days.
 
Venus Ong
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the reply, Tim

I have tried the @EJB annotation, but it always point me to a NullPointerException.

I think I should direct my question at the EJB forum.

Link to new post
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!