EJBs are ideal for writing business logic in web applications. They can act as the perfect bridge between web interface components such as JSF, servlet, or JSP and data access objects such as JDO. EJBs can be distributed across multiple JEE application servers (this could improve application scalability), and their life cycle is managed by the container. EJBs can be easily injected into managed objects or can be looked up using JNDI.
Eclipse JEE makes creating and consuming EJBs very easy. Just like we saw how Tomcat can be configured and managed within Eclipse, JEE application servers, such as GlassFish, can also be managed from within Eclipse.
In the next chapter, we will learn how to create web applications using Spring MVC. Although Spring is not part of JEE, it is a popular framework to implement the MVC pattern in JEE web applications. Spring can also work with many...