Java EE - what is it?
Java EE is a platform built on top of Java SE that provides an API and runtime environment for developing and running large-scale, multi-tier, scalable, reliable, and secure network applications. Such applications are called enterprise applications because they solve problems faced by large businesses. However, it's not just large corporations and government agencies that can benefit from these types of applications and the benefits that Java EE provides. The solutions that the Java EE platform offers are useful, and sometimes simply necessary, for individual developers and small organizations.Java EE development
Java EE is developed through the Java Community Process (JCP), formed in 1998. It allows interested parties to participate in shaping future versions of the Java language platform specifications. The basis of this process is the JSR (Java Specification Request), formal documents describing the specifications and technologies that are proposed to be added to the Java platform. Such requests are made by community members - ordinary developers and companies. The latter include Oracle, Red Hat, IBM, Apache and many others. Those. the guys propose new features and goodies for consideration that they would like to include in Java. And then they hold a vote, on the basis of which a decision is made on what to include in the next version. The Java EE version history looks like this:- J2EE 1.2 (December 1999)
- J2EE 1.3 (September 2001)
- J2EE 1.4 (November 2003)
- Java EE 5 (May 2006)
- Java EE 6 (December 2009)
- Java EE 7 (May)
- Java EE 8 (August 2017)
- Jakarta EE 8 (September 2019)
Java EE Application Architecture
A short introduction. To make it easier to understand, let's talk about the structure of Java EE applications and some of the terms that we will use further. Java EE applications have a structure that has two key qualities:- Firstly, multi-level. Java EE applications are multi-tiered, and we will talk about this in more detail;
- secondly, nesting. There is a Java EE server (or application server), with component containers located inside it. These containers house (bingo!) components.
Application levels
Multi-tier applications are applications that are divided according to functional principles into isolated modules (levels, layers). Typically (including in the context of Java EE development), enterprise applications are divided into three levels:- client;
- average level;
- data access level.
-
The client layer is an application that requests data from the Java EE server (middle layer). The server, in turn, processes the client's request and returns a response to it. The client application can be a browser, a standalone application (mobile or desktop), or other server applications without a graphical interface.
-
The middle level is divided, in turn, into the web level and the business logic level.
-
The web layer consists of some components that provide interaction between clients and the business logic layer.
The following Java EE technologies are used at the web level:
- JavaServer Faces technology (JSF);
- Java Server Pages (JSP);
- Expression Language (EL);
- Servlets;
- Contexts and Dependency Injection for Java EE (CDI).
-
The business logic layer consists of components that implement all the business logic of the application. Business logic is code that provides functionality that covers the needs of some specific business area (financial industry, banking, e-commerce). This level can be considered the core of the entire system.
Technologies that are involved at this level:
- Enterprise JavaBeans (EJB);
- JAX-RS RESTful web services;
- Java Persistence API entities;
- Java Message Service.
-
-
Data access level. This level is sometimes called the level of enterprise information systems (EIS). EIS consists of various database servers, ERP (Enterprise Resource Planning) enterprise resource planning systems and other data sources. The business logic layer accesses this layer for data.
At this level you can find technologies such as:
- Java Database Connectivity API (JDBC);
- Java Persistence API;
- Java EE Connector Architecture;
- Java Transaction API (JTA).
Application servers, containers, components
Let's take a look at the definition of Java EE from Wikipedia. Java EE is a set of specifications and related documentation for the Java language, describing the architecture of the server platform for the tasks of medium and large enterprises. To better understand what a “set of specifications” means in this context, let’s draw an analogy with a Java interface. The Java interface itself is devoid of functionality. It simply defines some contract according to which some functionality is implemented. But other classes implement the interface. Moreover, one interface can have several implementations, each of which may differ from each other in some details. The specification is exactly the same. Naked Java EE is just a set of specifications. These specifications are implemented by various Java EE servers. A Java EE server is a server application that implements the Java EE platform APIs and provides standard Java EE services. Java EE servers are sometimes called application servers. Server data can contain application components, each of which corresponds to its own level in a multi-level hierarchy. The Java EE server provides various services to these components in the form of a container. Containers are the interface between the components they host and the low-level platform-independent functionality that supports the component. Containers provide specific services to the components they host. For example, development lifecycle management, dependency injection, concurrency, etc. Containers hide technical complexity and increase portability. There are four different types of containers in Java EE :-
Applet containers are implemented by most browsers. When developing applets, you can concentrate on the visual side of the application, while the container provides a secure environment.
-
The Application Client Container (ACC) contains a set of Java classes, libraries, and other files needed to implement features such as injection, security management, and naming services in Java SE applications.
-
The web container provides the core services for managing and executing web components (servlets, EJB Lite components, JSP pages, filters, listeners, JSF pages, and web services). It is responsible for instantiating, initializing and invoking servlets, and supporting the HTTP and HTTPS protocols. This container is used to serve web pages to client browsers.
-
The EJB (Enterprise Java Bean) container is responsible for managing and executing the EJB model components that contain the application's business logic layer. It creates new EJB bean entities, manages their lifecycle, and provides services such as transaction, security, concurrency, distribution, naming, or asynchronous invocation capabilities.
-
Applets are graphical user interface (GUI) applications that run in a browser. They leverage the rich Swing API to produce powerful user interfaces.
-
Applications are programs that run on the client side. They are typically graphical user interface (GUI) and used for batch processing.
-
Web applications (consisting of servlets and their filters, web event listeners, JSP and JSF pages) - run in a web container and respond to HTTP requests from web clients. Servlets also support SOAP and RESTful web service endpoints.
-
Enterprise applications (built with Enterprise Java Beans, Java Message Service, Java Transaction API, Asynchronous Calls, Time Services) run in an EJB container. Container-managed EJBs handle transactional business logic. They can be accessed either locally or remotely via RMI (or HTTP for SOAP and RESTful web services).
Technologies
So, we've sorted out the architecture. The overall structure should be clear. In the process of describing the architectural components, we touched on some Java EE technologies such as EJB, JSP, etc. Let's take a closer look at them. The table below shows the technologies that are used mainly at the client level:Technology | Purpose |
---|---|
Servlets | Java classes that dynamically process client requests and generate responses (usually HTML pages). |
Java Server Faces (JSF) | A framework for building web applications with a user interface. Allows you to include user interface components (for example, fields and buttons) on a page, transform and validate these components, and store this data in server-side storage. |
Java Server Faces Facelets technology | It is a subtype of JSF application that uses XHTML pages instead of JSP pages |
Java Server Pages (JSP) | Text documents that are compiled into servlets. Allows you to add dynamic content to static pages (such as HTML pages) |
Java Server Pages Standard Tag Library (JSTL) | A tag library that encapsulates core functionality in the context of JSP pages. |
Expression Language | A set of standard tags that are used in JSP and Facelets pages to access Java EE components. |
Contexts and Dependency Injection for Java EE (CDI) | Represents a set of services provided by Java EE containers for managing the life cycle of components, as well as injecting components into client objects in a secure way. |
Java Beans Components | Objects that act as temporary data storage for application pages. |
Technology | Purpose |
---|---|
Enterprise Java Beans (enterprise bean) components | EJBs are managed beans that contain the core functionality of an application. |
JAX-RS RESTful web services | It is an API for developing web services that comply with the REST architectural style. |
JAX-WS web service endpoints | API for creating and consuming SOAP web services. |
Java Persistence API (JPA) entities | An API for accessing data in data stores and converting that data into Java programming language objects and vice versa. |
Java EE managed beans | Managed beans that provide the application's business logic but do not require the transactional or security features of the EJB. |
Java Message Service | The Java Message Service (JMS) API is a messaging standard that allows Java EE application components to create, send, receive, and read messages. This ensures distributed, reliable and asynchronous communication between components. |
Technology | Purpose |
---|---|
The Java Database Connectivity API (JDBC) | Low-level API for accessing and retrieving data from data stores. A typical use of JDBC is writing SQL queries against a specific database. |
The Java Persistence API | An API for accessing data in data stores and converting that data into Java programming language objects and vice versa. Much higher level API compared to JDBC. Hides all the complexity of JDBC from the developer under the hood. |
The Java EE Connector Architecture | API for connecting other corporate resources, such as:
|
The Java Transaction API (JTA) | An API for defining and managing transactions, including distributed transactions and transactions across multiple data stores. |