Feb. 6, 2011, 2:09 a.m.
posted by hashspark
Web Components and EJB
Together, servlets and JSP provide a powerful platform for generating web pages dynamically. Servlets and JSP, which are collectively called web components , can access resources such as JDBC and enterprise beans. Because web components can access databases using JDBC, they allow an enterprise to expose its business systems to the Web through an HTML interface. HTML interfaces have several advantages over more conventional client interfaces. The most important advantages have to do with distribution and firewalls. Conventional clients need to be installed and distributed on client machines; they require additional work for deployment and maintenance. Applets, which are downloaded dynamically, can eliminate the headache of installation but have their own limitationssuch as sandbox restrictions and lengthy downloads. In contrast, HTML is extremely lightweight, does not require prior installation, and does not suffer from security restrictions. In addition, HTML interfaces can be modified and enhanced at their source without having to update the clients.
Firewalls present another significant problem in e-commerce. HTTP, the protocol over which web pages are requested and delivered, can pass through most firewalls without a problem, but protocols such as IIOP or JRMP cannot. This limitation is extremely important. It means that a client usually cannot access a server using IIOP or JRMP without modifications to the firewall, which is often not under the control of the groups who need the application to run. HTTP does not suffer from this limitation because almost all firewalls allow HTTP to pass unhindered.
The problems with distribution and firewalls have prompted most of the EJB industry to adopt an architecture based on web components (servlets/JSP) and Enterprise JavaBeans. Web components provide the presentation logic for generating web pages; EJB supplies a middle tier for business logic. Web components access enterprise beans using the same API as application clients. Each technology is doing what it does best: servlets and JSP are excellent components for generating dynamic HTML, and EJB is an excellent platform for business logic. Figure illustrates how the architecture works.
Using servlets/JSP and EJB together
This web component/EJB architecture is so widely accepted that it begs the question, "Should there be a united platform?" The Java EE specification answers this question. Java EE defines a single application server platform that focuses on the interaction among servlets, JSP, and EJB. Java EE is important because it provides a specification for the interaction of web components with enterprise beans, making solutions more portable across vendors that support both component models.