Java 2 Enterprise Edition (J2EE) follows the General Web Architecture which was described on a separate page. As discussed in the evolution of Java, Java was initially touted as a strong client-side contender in the mid-1990s. However in the late 1990s, it evolved and gained much more acceptance as a solid middle tier tool. Over time, Sun added components to its middle tier solution (Servlets, EJB) until in mid-1999, Sun released its J2EE specification which provided a comprehensive view of the Java middle tier solution. Java solution providers have embraced J2EE which we will now explore.
J2EE implements the Presentation Layer with Servlets and, more recently, Java provides the option to generate webpages with dynamic content using JavaServer Pages (JSP). Servlets/JSP generate webpages with dynamic content (typically originating from the database). They also parse webpages submitted from the client and pass them to Enterprise JavaBeans for handling. Servlets and JSPs run inside a Web Server.
J2EE implements the Business Logic layer with Enterprise JavaBeans (EJB). Enterprise JavaBeans are responsible for logic like validation and calculations as well as provided data access (e.g. database I/O) for the application. Enterprise JavaBeans run inside an Application Sever.
Under J2EE, EJBs access a database through one of two means:
In addition to these components for web application, J2EE provides for access by non-web clients to the business logic layer. A standalone Java application (IIOP client) can access an EJB directly using J2EE's Remote Method Invocation (RMI) API.
Important parts of J2EE are explored in more detail on separate pages: