S Gokul
Java 2 for enterprise edition adopts a multi-tier application programming
model for developing flexible and reusable business applications and components.
By providing a basic infrastructure for lower level services like maintaining
resource pools, handling threads, managing transactions, balancing heavy loads
and scaling components, J2EE allows the developer to fully concentrate on
developing his or her business logic code — without bothering much about
complex middleware services that are hard to handle.
J2EE Application Programming Model
Before proceeding further, let us look at the basic structure of the J2EE
Application Programming Model spanning across multiple tiers. Each tier houses
its own set of components - which work in synchronization - to provide the
enterprise services to various client requests. Click here
to view image.
Client tier components
Clients for the J2EE enterprise environment can either be external clients or
internal clients.
External clients include all Internet users, who log on to the enterprise’s
eBusiness portal to avail the services offered via the Net. They also include
all mobile clients who access a similar set of services via their WAP phones.
Internal clients represent various in house departmental staff of the
enterprise, who typically make use of Intranet (which is again a Web client) or
desktop client-server GUI applications to access another set of enterprise
services.
Thus, the varieties of requests pouring into the J2EE enterprise middleware
can emerge from one or more of the following clients:
- Internet Web browsers
- Intranet Web browsers
- Desktop GUI applications
- WAP devices
J2EE responds to Web-based Internet and Intranet requests by rendering the
processed business information as HTML Web pages. Sometimes, these HTML pages
may make use of Applets and Javascripts for additional functionality. Mobile WAP
clients need to be responded by means of WML pages.
The responsibility of serving out the processed business information as HTML/WML
pages is handled by the presentation logic tier — which uses HTTP Web Servers
and WAP Servers to issue out the deliverables via the network.
Desktop GUI applications usually bypass the presentation logic tier and
correspond with business logic components directly (and hence the direct
communication link, in the diagram) — because presentation logic is typically
embedded inside the client application itself. Kindly note that this kind of
direct access to business logic components is permissible only when all internal
enterprise clients are assumed to be fully trusted.
Presentation logic components (or Web components)
The presentation logic tier is meant for visually presenting the processed data
to the clients and not for doing any business processing.
Components of this tier are typically based on request-response models. i.e.
they receive the requests emanating from the clients, pass them on to business
logic components for processing, receive the processed results and then send
them back to clients, in the required format. For example, they can receive a
http request from a client browser, forward the request to an EJB for
processing, receive the processed business data, format them as HTML pages and
send them back to the client browser for display.
The presentation logic components of J2EE infrastructure for a given business
environment can be:
HTML/XML/WML pages
- Pages written to different markup language specifications to serve
different clients - HTML and XML pages can be read by Web browsers and WML pages can be
interpreted by WAP enabled mobile phones - These pages reside in HTTP or WAP Web Servers
Java Servlets
- Java Servlets are standard server side Java extensions to the basic Web
server framework - They provide additional functionality to the server and enable dynamic
content creation and delivery - Programmers can develop their own ‘servlets’ for their business
applications by extending the basic servlet provided by the Servlet API - Servlets reside in Servlet Engines, which are Java Servlet API
implementations for different commercial Web servers