Client/EJB Integration

Now that we've explained the differences between the various bean types and have seen how they're developed, we can look at how clients actually interact with EJBs. Per the J2EE architecture, a client can be one of the following:

  • An applet

  • A servlet

  • Another EJB

  • A Java Message Service (JMS) provider (depending on the bean)

Generally, a client uses the home interface and either the remote or the local interfaces of an EJB in order to communicate with it. Choosing remote or local is, for the most part, only applicable if the client resides on the same machine as its target.

We've seen how one EJB can communicate with another in our example BenefitEnrollerBean (Listing 8-7, lines 90 through 95). Now let's take a look at another ...

Get Building Scalable and High-Performance Java™ Web Applications Using J2EE™ Technology now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.