Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB3 + JSF2

 
eve agostini
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all!
I'm getting in touch with EJB3 and trying to figure out if it makes sense to use it with JSF and which is the best way to do it.
I'm new to EJB while I've been using JSF for a while (JsSF 2 now).

In particular I'm getting a little confused about the integration of JSF managed beans and EJB session beans. I know that I can inject an EJB session bean in a JSF managed bean; but it's also true that I actually could invoke EJB session bean's method directly from an xhtml page and just bypass managed beans. I mean, which is the best way to share responsibilities among them?

Also, I got a little confused about scopes. I set up a little app with a managed bean and a stateless session bean. I though that the stateless session bean was supposed not to maintain state but it does (a member variable value is kept among different invocations). And this is true both in case the managed bean has request scope and in case it has session scope. Is it just a coincidence? I mean, because of the fact that the container is responsible for creating and destroying beans so I cannot be sure that the stateless bean is actually reinitialized at each request?

Thanks for any help

Eve
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic