B.1. Designing with J2EE

Each of the three main components of J2EE discussed previously is run in the confines of a container. For JSP and Servlets, this container may be a Web server. For EJB, it's an EJB container (possibly also a Web server). The container is responsible for instantiating and invoking the operations on the classes of each of the J2EE components. For instance, the javax.servlet.Servlet interface defines various methods that the Servlet container will invoke, but the container actually invokes our realization of this interface, albeit indirectly. This is a prime example of J2EE compliance with the Open-Closed Principle.

If we were to attempt to develop a Servlet that didn't adhere to the Servlet API, we couldn't use it within ...

Get Java™ Design: Objects, UML, and Process now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.