From the course: Java EE 8 Essential Training

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

EJB clients

EJB clients - Java EE Tutorial

From the course: Java EE 8 Essential Training

Start my 1-month free trial

EJB clients

- [Instructor] In this lesson, we're going to create a client for our EJB. The client of the EJB is going to access the list of items and add items to the list through the methods defined on the catalog local interface. Now, because this EJB is storing state and we would like that state to be consistent across all clients of our application, we're going to go ahead and turn this into a Singleton bean. From there, we can then navigate over to our CatalogItemFormBean. So this bean is the backing bean for the form and the list within our JSF application. Now, within this bean, we can inject the EJB. So we'll declare a new field of type CatalogLocal and we'll call it catalogBean and then we just add that EJB annotation and the EJB will be injected into this bean and we can leverage it. Now, you'll notice that right now, we're leveraging our items list and we no longer want to use that list for the purposes of…

Contents