This article provides a high-level introduction to J2EE. It is taken from chapter one of the book Beginning J2EE 1.4 From Novice to Professional, written by James L. Weaver, Kevin Mukhar, and Jim Crume (Apress, 2004; ISBN: 1590593413).
In this opening chapter to the book, we have covered an overview of the J2EE and how all the various bits fit together to enable you to create powerful business components. We first looked at what exactly J2EE is and tackled the obvious issue of moving from creating desktop applications with Java 2 Platform, Standard Edition (J2SE) to building enterprise-level applications and dynamic, data-driven web sites using the Enterprise Edition of the Java 2 Platform, J2EE. We covered how the two relate to each other and how they differ from each other, as well as looking at how applications are built using J2EE.
Next we looked at what makes up a J2EE application. J2EE architecture is based on the idea of building applications around multiple tiers of responsibility. The application developer creates components, which are hosted by the J2EE containers. Containers play a central theme in the J2EE architecture.
Servlets are one type of J2EE web component. They are Java classes that are hosted within, and invoked by the J2EE server by requests made to, a web server. These servlets respond to those requests by dynamically generating HTML, which is then returned to the requesting client.
JavaServer Pages (JSPs) are very similar in concept to servlets, but differ in that the Java code is embedded within an HTML document. The J2EE server then compiles that HTML document into a servlet, and that servlet generates HTML in response to client requests.
Enterprise JavaBeans are the centerpiece of J2EE and are the component model for building the business rules logic in a J2EE application. EJBs can be designed to maintain state during a conversation with a client, or can be stateless. They can also be designed to be short-lived and ephemeral, or can be persisted for later recall. EJBs can also be designed to listen to message queues and respond to specific messages.
The J2EE platform provides a number of services beyond the component hosting of servlets, JSPs, and EJBs. Fundamental services include support for XML, web services, transactions, and security.
Extensive support for XML is a core component of J2EE. Support for both document-based and stream-based parsing of XML documents forms the foundation of XML support. Additional APIs provide XML registry service, remote procedure call invocation via XML, and XML-based messaging support.
Web services, which rely heavily on XML, provide support for describing, registering, finding, and invoking object services over the Web. J2EE provides support for publishing and accessing J2EE components as web services.
Transaction support is required in order to ensure data integrity for distributed database systems. This allows complex, multi-step updates to databases to be treated as a single step with provisions to make the entire process committed upon success, or completely undone by rolling back on a failure. J2EE provides intrinsic support for distributed database transactions.
J2EE provides configurable security to ensure that sensitive systems are afforded appropriate protection. Security is provided in the form of authentication and authorization.
After reading through the chapter, you might think that J2EE is just about EJBs. The truth is that it is about a lot more than EJBs, although EJBs do play a prominent role within J2EE. J2EE provides a platform for developing and deploying multi-tiered, distributed applications that are designed to be maintainable, scaleable, and portable.
Just as an office building requires a lot of hidden infrastructure of plumbing, electricity, and telecommunications, large-scale applications require a great deal of support infrastructure. This infrastructure includes database access, transaction support, and security. J2EE provides that infrastructure and allows you to focus on application.
Building distributed applications (software with components that run as separate processes, or on separate computers) allows you to partition the software into layers of responsibility, or tiers. Distributed applications are commonly partitioned into three primary tiers: presentation, business rules, and data access. Partitioning applications into distinct tiers makes the software more maintainable and provides opportunities for scaling applications up as the demand on those applications increases.
Thatís it for your first taster of how J2EE works and why it is so popular. In the next chapter, youíll see the extra steps required to set up your environment, ready for developing powerful J2EE applications.
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.