Today, more and more developers want to write distributed
transactional applications for the enterprise and leverage
the speed, security, and reliability of server-side technology.
One approach is to use a multitiered model where a thin-client
application invokes business logic that executes on the server.
Normally, thin-client multitiered applications are hard to write
because they involve many lines of intricate code to handle
transaction and state management, multithreading, resource
pooling, and other complex low-level details.
The JavaTM 2 Platform, Enterprise
Edition (J2EE), architecture makes these applications easy to
write because the low-level details are separated from the
business logic. J2EE application developers concentrate on
creating the best business solution and leave the rest to the
underlying platform.
Developing J2EE Applications
J2EE application developers write application components.
An application component is a self-contained module that
is added to and interfaces with other application components.
Application components include thin-client applications, applets,
servlets, and Java ServerPagesTM;
and server-side Enterprise JavaBeansTM.
Application components are bundled into archive files such
as Java Archive (JAR) or Web Archive (WAR), assembled into
complete J2EE applications, and delivered as Enterprise Archive (EAR)
files.
An example J2EE application could have an HTML form to prompt the user
for data, a servlet to receive the data from the form and process it,
and an Enterprise Bean to store data in a database.
The HTML form and servlet are bundled in a WAR file, the Enterprise
Bean is bundled in a JAR file, and the WAR and JAR files are both
added to the EAR file, which is deployed to production.
The J2EE application model is very flexible. This same application could,
for example, be assembled to use either an applet or an HTML page with
Java ServerPages code instead of the HTML page and servlet. It is
simply a matter of assembling the EAR file with the applet archive file
instead of the HTML page and servlet archive file.
Getting Started
To write J2EE application components, an application programmer
needs to obtain a J2EE product from a product provider. Product
providers are typically operating system, database system,
application server, or web server vendors who implement the
J2EE platform according to the
Java 2 Platform Enterprise
Edition Specification.
The product contains the J2EE APIs, J2EE application server, a web server, a
database, and deployment tools. In short, everything needed to write and
assemble application components, and to deploy complete J2EE applications.
You also need to get the free downloads of the J2EE Reference implementation
and Application Programming Model (APM),
While you do your actual development on the J2EE product, you
need the reference implementation to verify that your J2EE
application components are fully portable. You use the J2EE
Application Programming Model to guide you in making the best
design and implementation decisions.
The J2EE architecture also includes the Compatibility Test Suite.
The J2EE Compatibility Test Suite is used by providers to verify their
products and tools are compatible with the J2EE standard. This suite is not
available for the Beta release.
Reference Implementation
Sun Microsytems provides a free download of its
J2EE
platform Reference Implementation.
The reference implementation is an operational definition of the J2EE platform
and specification. It is not a commercial product and its licensing agreement
prohibits commercial use. However, it is freely available for demonstrations,
prototyping, and education as follows:
-
Product providers use the J2EE Reference Implementation to determine what
their implementations must do under a given set of application conditions,
and to run the J2EE Compatibility Test Suite to test that their J2EE products
fully comply with the specification.
-
Developers run their J2EE applications on the J2EE Reference Implementation
to verify the applications are fully portable across all J2EE products and tools.
To support J2EE applications development, the J2EE Reference Implementation
includes Java WebServerTM, Cloudscape database,
Java Software application server, Extensible Markup Language (XML) support,
the J2EE APIs, and Java Plug-In. Java Plug-In lets you run Java 2 applets
in browsers that support an earlier release of the Java Runtime Environment
(JRE). The J2EE Reference Implementation also provides J2EE deployment
tool for deploying Enterprise Archive files, and development tools for
doing things like starting the application server, verifying archive files,
and creating database tables.
J2EE APIs
The J2EE APIs listed below are standard extensions to the Java 2 SDK, Standard
Edition. The Java 2 SDK, Standard Edition, is required to run the J2EE Reference
Implementation, and provides core APIs for writing applets and applications, core
development tools, and the Java virtual machine1.
Servlets 2.2
javax.servlets and
javax.servlets.http
Lets you extend a server program to enhance its
functionality. Servlets are commonly used to extend a
web server by providing dynamic content.
Java ServerPagesTM 1.1
javax.servlets.jsp and
javax.servlets.jxp.tagext
Lets you put snippets of servlet code directly into a static
HTML page.
Enterprise JavaBeansTM 1.1
javax.ejb and
javax.ejb.deployment
Lets you write a body of code with fields and methods to
implement modules of business logic.
JDBCTM 2.0
javax.sql
Provides uniform access to a wide range
of relational databases.
RMI-IIOP 1.0
javax.rmi and
javax.rmi.CORBA
Lets RMI code look up an object using
CORBA services.
Java Message Service 1.0
javax.jms
Lets you write code to access enterprise messaging systems.
Java Naming and Directory Interface
(JNDITM) 1.2
javax.naming, javax.naming.directory,
javax.naming.event, javax.naming.ldap, and
javax.naming.spi.
Provides a unified interface to multiple naming and
directory services in the enterprise so application components
can access naming and directory services.
Java Transaction API 1.0
javax.transaction
Provides a standard demarcation interface for demarcating
transactions. This API is
not available in J2EE Reference Implementation, Beta release.
JavaMailTM 1.1
javax.mail
Provides a framework to build mail and messaging
services so application components can send email.
JavaBeans Activation Framework 1.0
javax.activation
This API is included because JavaMail uses it.
It provides standard services to determine the type of an
arbitrary piece of data, encapsulate access to it, discover
the operations available on it, and instantiate the appropriate
Bean to perform those operations.
Extensible Markup Language (XML)
The J2EE platform supports Extensible Markup Language (XML) so servlets and
Java ServerPages executing in the web server can generate both HyperText Markup
Language (HTML) pages and XML format data. XML is a text-based markup language
for defining what information is as opposed to how it looks.
For example, in an XML document you can define the words Zelda Zee to
be a customer name and ZZ to be a customer ID. This way, the
information can be handled according to what it is. In HTML, you can
make Zelda Zee and ZZ appear in bold or italics, but you cannot
define them to be a customer name and customer ID.
Document Type Definition (DTD) is part of the XML specification. It
specifies the kinds of tags that can be icluded in an XML document,
and the valid arrangements of those tags. A DTD is used to validate
XML structures to make sure you create only valid XML structures and that XML
structures you send or receive are valid.
Programs to access XML documents use Simple API for XML (SAX) or
Document Object Model (DOM) APIs. However, these APIs are not
currently part of the J2EE specification.
Application Programming Model
The J2EE Application Programming Model is a standard programming model
for developing multitier, thin-client applications on the J2EE platform.
It consists of a body of technologies and principles to guide the
J2EE applications developer in doing such things as deciding on the most
appropriate implementation options, making the best use of Java
ServerPages and servlets, choosing a good design when implementing
business logic, and effectively mapping the J2EE security model to enterprise
computing environments and infrastructures.
The APM is described in the
J2EE
Application Programming Model document. To put the model
into practice, the APM document presents an example application
designed and implemented according to the APM. Of course the
example and explanatory text show one way to put the model into
practice and should be taken as illustrative only. As with any
model, the APM model should serve as a guide because there will
always be more than one right way to use it.
Reader Feedback
Tell us what you think of this article.
1 As used on this web site, the terms Java virtual
machine or Java VM mean a virtual machine for the Java platform.