Home > Java > javaTutorial > J2EE Technologies

J2EE Technologies

WBOY
Release: 2024-08-30 15:13:41
Original
623 people have browsed it

J2EE is a short form of Java 2 Enterprise Edition, formerly Java 2 Platform Enterprise Edition, with specifications extending Java 2 Standard Edition(J2SE). J2EE offers a built-in set of services utilized on a large scale, supporting multi-tier, component-based, and distributed architectures. Usually, J2EE is a set of APIs that helps build large-scale applications. J2EE Technology uses the APIs and is a standard for building and deploying enterprise applications. It promises “write once, run anywhere”.

ADVERTISEMENT Popular Course in this category J2EE - Specialization | 14 Course Series | 6 Mock Tests

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

Java Enterprise Edition includes several specifications for various purposes like generating web pages, reading and writing from the database, and managing distributed queues.

List of J2EE Technologies

Graphical Representation of the J2EE Platform.

J2EE Technologies

1. Java Servlet

Java servlets run on a web server, generate dynamic web pages, handle requests from web browsers, process the requests, and send the processed data back to the browser.

Common Gateway Interface (CGI) is also used for developing dynamic webpages, but it has several limitations, such as performance, scalability, reusability, etc. To overcome this limitation, we can use servlet.

One of the most important drawbacks of CGI is- every time any new request from the user CGI program handles it by creating a new process. If a large number of users increases, then CGI has to create a new process for every request; creating a new one for each process is not valid for the server side because it has limited resources. Unlike CGI, separate threads handle servlet programs.

J2EE Technologies

Servlet Execution Process:

  • The client sends a request.
  • The web server receives the request.
  • The web server passes requests to the corresponding servlet.
  • Servlet processes request and generate a response in the form of output.
  • Servlet sends a response back to a web server
  • The web server sends a response to the client.

2. Java Server Pages (JSP)

Developers use Java Server Pages for server-side programming to create dynamic web pages and build web-based applications.

Features of JSP:

  • JSP performance significantly increases because it allows users to embed Java code within HTML.
  • Like a servlet, JSP also has access to Enterprise Java APIs
  • Developers also use JSP pages in combination with servlets.
  • JSP tags which allows embedding java code with HTML are <%—–JSP code—- %>
  • Embedding JSP code within HTML makes HTML pages dynamic, like registration forms, dropdown boxes, etc.
  • JSP is used to access Java Beans Objects.
  • JSP separates the presentation layer from Business Logic.
  • It provides the easiest way to generate dynamic web pages compared to servlets.
  • The web container handles any changes in JSP code without requiring recompilation.
  • Like servlets, JSP [does not require additional files Class Files and web, XML.
  • Additional web.xml mapping is not necessary for JSP.

The Architecture of JSP:

J2EE Technologies

Working of Architecture #1

In this architecture, JSP plays an important role in processing client requests.

  • A client sends a request to JSP
  • JSP Creates JavaBean Object.
  • JavaBeans process request using necessary data from the database if required.
  • The server sends the response back to the client.

J2EE Technologies

Working of Architecture #2

In this architecture, Servlet plays an important role. The servlet acts as a controller.

  • The client sends a request.
  • Servlet processes the request sent by the client.
  • The servlet creates a bean object and calls a specific JSP page.
  • Here JSP does not process any client request.
  • JSP performs the presentation part.

3. Enterprise Java Bean (EJB)

Enterprise Java Beans is a development architecture for building highly scalable and robust enterprise-level applications.

Features of EJB:

  • The developer has to focus on the application’s business logic since the application server provides most of the system-level services, Transaction, Logging, exception handling, etc.
  • EJB container manages all EJB instances.
  • EJB components run on any compliant EJB compliant server. These benefits on platform-independent.

Types of Enterprise Beans:

a. Session Bean

Session beans perform the task for the client. The client can programmatically invoke the encapsulated business logic.

There are three types of session beans:

  • Stateful Session Bean: The instance of the Stateful session bean represents the state of a unique client, often called the conversational state. It is also called an interactive session, and it is associated with only one user. The state is retained once the client removes the beans session ends, and the state disappears.
  • Stateless Session Bean: Stateless session instance does not maintain a conversational state with the client. When a client invokes, a method of stateless bean variable contained specific to that client but only for the invocation duration. The instance applies to all clients. Can implement a web service.
  • Singleton Session Bean: Instantiated once per application and exist for the application’s lifecycle. Used when a single instance bean is shared all across concurrent clients. The server maintains states between client invocations but is not required to maintain state across server shutdowns. It should be instantiated upon application start-up.

b. Message Driven

A message-driven bean is a listener for a particular message type, such as a Java message server API.

EJB Architecture:

J2EE Technologies

4. Java Database Connectivity (JDBC)

Java Database Connectivity is a Java API used to connect and execute queries. It uses JDBC drivers for connectivity.

Types of Drivers:

  • JDBC-ODBC Bridge driver
  • Native Driver.
  • Network Protocol Driver.
  • Thin Driver.

Features:

  • ODBC uses ODBC drivers for connection since these are platform-dependent, so Java developed its own JDBC API.
  • Java can be used to write different type’s executables, including- Java Applets, JSP, EJB, Servlets, etc.

JDBC Architecture:

JDBC architecture is divided into two types

  • Two-tier architecture.
  • Three-tier architecture.

a. Two-Tier Architecture

Graphical representation of Two-Tier Architecture.

J2EE Technologies

The Java application is directly accessed from the database in this two-tier architecture. Client access data directly with the use of the JDBC driver. The database may be located in the same machine or another machine in a client-server configuration.

b. Three-Tier Architecture

Graphical representation of Three-Tier Architecture.

J2EE Technologies

This architecture sends commands to the middle tier, which processes the request and then forwards it to the data source. The data source processes the request, and the results are sent back to the middle tier, which is then sent to the user. Three-tier maintains control over data access and update made to corporate data.

5. Java Message Service (JMS)

Java Messaging Service is an API that provides formal communication between computers in a network called Messaging Service.

  • Exchanging of messages can be synchronous or asynchronous mode.
  • JMS API allows interoperability between other Java platform languages.
  • Applications are built on concept message queue, sender, and receiver.

There are two types of messaging domains in JMS.

a. Point-to-point messaging domain

  • Applications are based on the concept of queues, sender, and receiver.
  • Each message sent to a messaging queue receiver stores messages in the messaging queue.
  • Queue stores all messages until it consumes or expires.
  • If the receiver is unavailable in a network, the message will remain, message broker, until the receiver consumes the message.
  • The receiver acknowledges the message consumption.

b. Publish/Subscribe to Messaging Domain

  • Applications send messages to message brokers called topic.
  • Topic publishes a message to all subscribers.
  • The topic retains all messages until the receiver consumes it.
  • Here multiple consumers and consumers will get messages after subscribing.

JMS Architecture:

J2EE Technologies

6. Java Transaction API (JTA)

JTA allows performing distributed transactions to access and update data by multiple computers in a network. JTA API act as a Java interface between Transaction Manager and the client.

The application server and resource manager control access to shared resource transactions.

  • Atomicity: The transaction manager is responsible for making a final decision either to commit or roll back.
  • Provides consistency: If a transaction fails, data integrity is preserved.
  • Not possible to phase off the transaction until the transaction by other applications or threads is committed or rolled back.
  • Committed can be preserved even in case of system failure.
  • Three types of transaction Managers.
  • Database: transactions prevent the database from being left in an inconsistent state due to an incomplete update.
  • JMS providers-use of transactions ensures messages are delivered reliably.
  • J2EE connector Architecture components.
  • Container Managed Transactions: The EJB container sets the boundaries of the transaction, and it can use any enterprise bean. The code does not include statements that begin and end a transaction.
  • Component Managed Transaction: Transactions are managed by JDBC API, which allows transaction management in the application itself. Message-driven beans explicitly mark the boundaries of transactions.

JTA Architecture:

J2EE Technologies

7. Java Mail

Java Mail is API. This allows us to compose, read and write emails. This API provides protocol-independent and platform-independent.

Protocols used with Java Mail API:

  • SMTP: SMTP (Simple Mail Transfer Protocol) is a mechanism to transfer emails. Apache James Server and other mail server software can be used as an SMTP server to send and relay emails.
  • POP: POP is Post Office Protocol /POP3. It is a mechanism to receive the email. Supports a single mailbox for each user. Apache James Server, the mail server, can be used for POP functionality.
  • IMAP: Internet Message Access Protocol is an advanced protocol for receiving messages. Supports multiple mailboxes for each user.
  • MIME: Multiple Internet Mail Extension tells the browser what is being sent, like the format of the email, attachments, etc.

Java Mail Architecture:

J2EE Technologies

8. Java Naming and Directory Interface (JNDI)

Java Naming and Directory Interface is an API for Naming and Directory Service that allows users to discover data using specific names.

  • JNDI is independent of implementation.
  • It provides Service Provider Interfaces (SPI) – allows directory service plugged into the framework.
  • Developers use the API to connect Java applications to an external directory.
  • It provides a mechanism to bind an object to the name.
  • The event interface allows clients to determine when directory entries have been modified.

JNDI uses the following naming and directory services.

  • Lightweight Directory Access Protocol (LDAP).
  • Common Object Request Broker Architecture (CORBA).
  • Common Object Services (COS)
  • Java Remote Method Invocation (RMI).
  • Domain Name Service (DNS).

JNDI Architecture:

J2EE Technologies

9. J2EE Connector Architecture (JCA)

The application server uses JCA to connect to an EIS.

  • JCA-enabled application server integrates with any JCA-compliant EIS.
  • Resource Adapter allows Java applications to access and interact with the resource manager of EIS.
  • It also provides message-based transactional integration Java EE-based web services with EIS.

JCA Defines a standard set of system-level contracts between the Java Application Server and Resource Adapter.

  • Connection Management: Enables application Sever pool connection to EIS. Enables application components to connect. This benefits a scalable application environment and supports a large number of clients.
  • Transaction Management: Allows an application server to use transaction manager to manage transactions of multiple resource managers. This software supports the internal management of transactions without involving external transaction managers.
  • Security Management: Prevents security threats to EIS and protects valuable resources managed by EIS.
  • Life Cycle Management: Enables application server to manage the lifecycle of a resource adapter from beginning through termination.
  • Work Management: Enables resource adapter to assign work to the application server for execution. The application server dispatches threads to complete assigned work.
  • Transaction Inflow Management: Allows the resource adapter to propagate imported transactions to the application server. Allows resource adapter to transmit transaction completion and crash recovery initiated by EIS.
  • Message Inflow Management: Allows asynchronous delivery of messages to message endpoints residing application server.

JCA Architecture:

J2EE Technologies

Conclusion – J2EE Technologies

2EE optimizes enterprise computing or enterprise applications that provide client enhancement. Containers or application servers provided by almost all J2EE technologies facilitate fast development and deployment, as Java’s platform-independent standards ensure cross-platform development that can run on multiple platforms. Most of the technologies in J2EE separate design and development.

The above is the detailed content of J2EE Technologies. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template