Core Java

What is Java EE

In this article, we will explain what is Java EE( java enterprise version) using examples.

1. Introduction

Nowadays, it is a world of distributed computing. We see computing resources such as are geographically spread across and yet require collaboration to accomplish their tasks and computing needs. This demands well-thought specifications for clear understanding and protocols for communication, presentation, data storage, data processing, integration between the services.

Modern apps consist of components, deployed independently and capable of receiving and sending communications over the network, called web services.

In this context, it is worth mentioning the 3-tier or multi-tier application architecture. The figure shows the tiers in a typical application. It includes Presentation tier, Web tier, Business tier, and Database/EIS tier.

What is Java EE - 3-tiers in an Enterprise Application
3-tiers in an Enterprise Application

2. What is Java EE?

As per the Java EE documentation, Java EE platform uses a distributed multitiered application model for the enterprise applications. Enterprise Applications provides tools and business logic to model real-time businesses. Java EE is a set of specifications and APIs to address all the four layers of an Enterprise Application as shown in the above figure.

Java EE is built over Java SE which works on Write-Once Run-Anywhere principle.

3. What does Java EE contain?

In this section, we list all the components of Java EE with components. The components are grouped by each of the tiers in the application.

3.1 Client Tier

The client tier consists of non-Java components such as HTML, Javascript, and Jquery.

3.2 Web Tier

Java EE offers web clients that render User Experience for the users in the form of HTML and Javascript. These components are the web components that run on a Java EE server.

Web clients typically work on a request-response model where-in the users request for some answers from the Java EE server and the web components respond with a response. All these communications are happening over the HTTP protocol.

What is Java EE - Request-Response Model
Request-Response Model

Servlets: Servlets are Java API to process incoming server requests and respond with a response in the form of HTML and JavaScript. Servlets are the Java classes that implement the HttpServlet interface. For details on servlets work check-out our another article from Java Code Geeks.

Java Server Pages: JSPs are an improved way of writing servlets. You can use markup called scriptlets such as <% and %>. JSPs also support UI tools such as tiling, templating, and many interesting features for rapid UI development. For the examples on JSPs check out our other article from Java Code Geeks.

Java Server Faces: Java Server Faces (JSF) are component-based scriptlets which can be embedded in any JSP or XHTML. Unlike JSPs, JSFs are component-based and event-based such as a click of a button, type, hover, etc., Further, JSFs have a backing bean that serves the business logic and access to all the other Java EE components in the server. For the examples on JSPs check out our other article from Java Code Geeks

For more details on the Web Tier components, check this page.

3.3 Business Tier

Enterprise Java Beans (EJB): EJB (Enterprise Java Bean), which is hosted by any Java EE application server, that computes business functionalities. It typically involves components that consume SOAP-based XML requests for business functions and respond with an XML for the expected business function results.

They also include components that offer REST-style communication protocol where-in they host REST API based endpoints where the Java EE components call the REST API using typically JSON-based or XML-based requests and the response.

Managed Beans: Managed beans are independent POJO (Plain-old Java Objects) which are managed by Java EE-compliant servers. Java servers manage the lifecycle and dependencies of managed beans. They create, inject, contain, and finally destroy them whenever not required.

These managed components can be accessed web-tier components such as JSP and JSFs but also be accessed by EJB and any other tier components. Unlike EJBs, these are not accessible outside of containers using any HTTP like communication protocols.

Java Message Service API: Java Message Service API is backbone support for event-driven architecture where the Java EE components interact with each other asynchronously. JMS API help the components to create, send and receive messages

JMS API is used to integrate two enterprise applications. For example, in an order processing application, you can see the ordering system talking to accounts to collect the payment once the order is initiated, and talking to the warehouse to ship the product once the order is created successfully.

What is Java EE - Applications interacting with other applications asynchronously
Applications interacting with other applications asynchronously

For more details on the Business Tier components, check the Java EE version page.

3.4 Database Tier

Java Persistence API: It offers something known as Java Persistence API or simply know as JPA. JPA contains all the necessary modules to model the database objects. JPA manages entities that map to tables in the database and each property in the bean map to each column. For developers, JPA provides annotations to give something called Object-Relation-Mapping (ORM) to bind Java Objects with the database table.

JPA also provides methods for creating, retrieval, storage, and archive of the entities from the database.

Check out the examples from one of our Java Code Geeks for JPA.

Java Persistence Query Language: JPQL is used to create queries on the tables based on the abstract schema. You can create dynamic queries and fetch the results using JPQL as given in our another article on named queries.

For more details on the Java Persistence API refer to the documentation at this page.

4. What is not considered a Java EE

Java EE only details with Enterprise Applications. The following are not covered under Java EE version:

  • Core Java API such as JDBC which internally used by Java Persistence API to connect and query with the databases
  • Spring framework is a framework that gives abstraction over Java EE.
  • Java EE does not cover modules for the mobile applications which is covered by J2ME.
  • Java EE does not cover client-tier technologies like applets for thick-client,
  • Java EE does not cover basic data structures like a linked list, hashmap, and trees.

5. Conclusion

In this article, we gave a broad perspective of the technologies offered by Java EE version through examples. For more information on Java EE refer to the official documentation.

Shivakumar Ramannavar

Shivakumar has 16+ years of experience in Java Development, Cloud and also has a lot of passion in Cloud-native Applications and Kubernetes. Shiva has a Bachelor's Degree from Visweswaraiah Technological University, India. Shiva has been involved in the development of IT systems using Java/J2EE, Kubernetes, and has designed tonnes of applications both on-premise and on-cloud. Shiva strongly believes there is a great revolution of cloud-native technologies and that we can create a world of difference through learning, sharing, and caring among the community.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Back to top button