concept JSF - back bean in category ejb

appears as: JSF-backing bes, JSF-backing be
EJB 3 in Action, Second Edition

This is an excerpt from Manning's book EJB 3 in Action, Second Edition.

As of Java EE 6, technically you can use EJBs directly as JSF-backing beans. Although this is possible and might be useful for rapid prototyping, this is generally an approach we recommend that you avoid. Session beans shouldn’t be used for page navigation or processing the request parameters from a web form. These are tasks best suited for JSF-backing beans or plain CDI-managed beans. Putting this logic in a session bean pushes the session bean up into the UI layer. Mixing UI logic and business logic makes for messy code that’s hard to maintain in the long run.

But the innovations that were introduced in Java EE 5 with EJB 3 were primarily limited to EJBs. Using EJBs from the web tier required a substantial amount of boiler-plate code to retrieve instances from JNDI. JSF-backing beans were rudimentary and offered few services. Solutions such as JBoss Seam attempted to fill this gap by providing an advanced bean container that bridged the EJB and POJO world and also by providing additional services to non-EJB beans. The Java community took notice, and JBoss Seam served as the inspiration for CDI that was introduced as a core technology in Java EE 6 and expanded in Java EE 7.

To effectively use CDI and EJB, it’s best to examine the sample code in this chapter. Although ActionBazaar is a tiny application with some sections contrived and compressed for succinct code examples, it illustrates some of the best practices for integrating the two technologies. CDI is used in lieu of JSF-backing beans and support, the JSF interface. Note that CDI isn’t tied to JSF—CDI is agnostic to the web framework. CDI beans keep the business layer clean by isolating UI functionality in a distinct layer. This is also good to do with both SOAP and RESTful web services—an EJB shouldn’t be coded to support a SOAP-based web service or return JSON data for a RESTful service. A good architecture for your application, which isolates responsibility into separate layers, is made easier with CDI because CDI makes the integration between layers seamless.