aspose file tools*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Would you ever use injection for referencing an EJB in a JSF managed bean? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Would you ever use injection for referencing an EJB in a JSF managed bean?" Watch "Would you ever use injection for referencing an EJB in a JSF managed bean?" New topic
Author

Would you ever use injection for referencing an EJB in a JSF managed bean?

emanuel petre
Greenhorn

Joined: Mar 13, 2008
Posts: 14
Some people here said that the ServiceLocator is not anymore needed in EJB 3 because of the new way of injecting dependencies trough annotations.
This can be true in case of EJB -> EJB dependency. But, in case you want to call an EJB from the web tier, you still need to use a Service Locator. First,
you have the possibiltiy to inject an EJB by using annotations in the web components managed by server (like ServletListener or a JSF managed bean).
But, this way you expose the business tier directly to the presentation and you strongly couple the two. The only solution, I think, is to use a Business Delegate for abstractizing the business to the presentation. The Business Delegate will not be a component managed by the container. As a consequence, you cannot use injection in this case and you need a Service Locator.

That's why I think, the EJB injection shouldn't be used in a JSF managed bean.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Would you ever use injection for referencing an EJB in a JSF managed bean?
 
Similar Threads
SCEA Assignment: JSF Vs Struts
Managed Bean as service locator
Business Delegate in JEE5
SCEA v5 Certified
JSP in Sequence Diagram