Once you move into the world of web applications, you’ll find tasks that aren’t well suited for servlets and especially for JSPs. In particular, the most complicated business processes in enterprise Java are not easily coded up in a JavaServer Page. Dealing with complicated financial transactions, for example, isn’t something that fits well into a page of mostly HTML, or even into a servlet that is geared toward a request/response model. Instead, you need technology that provides security, transactions, and a strong server-side component model.
Enterprise JavaBeans ( EJB) refers to a specification that builds these types of server-side components. These components are installed into a J2EE application server. By writing Java components that conform to this specification, you take advantage of the application server’s sophisticated functionality as well as a known set of interfaces.
The specific functionality offered by a particular J2EE application server varies, but generally the use of EJB features prominently in J2EE applications. In the last chapter, you saw a simpler form of a web application based on JSP pages, servlets, and often a database and some helper classes. J2EE applications are a bit more complex, often having three, four, or more application tiers and involving five, six, or even ten different Java APIs. In these more complex cases, you need a J2EE application server instead of (or in addition to) a simple web container like Tomcat.