Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 29

Introduction to J2EE

Presented By:

Sapna Saxena
Lecturer, CSE Department
Chitkara University
Introduction
J2EE is not the Java , that comprises of topics like Applets, Console-
mode programs, Standalone GUI, Multithreading, Graphics,
Exception-handling, String processing, IO Streams, Java Beans in
BDK, Swing etc., with not any real life applications for example,
DataBase access! .
But that doesn’t means that Core Java is useless. As the name
suggests, it is the core and absolutely essential . But, Java has
always been a language for the Web and Enterprise. Without that
essential paradigm shift from desktop/LAN to the WEB & huge
enterprise data, it is  very difficult to appreciate the modern
trends and why there is so much demand for J2EE (despite  the
challenge from DotNet).  
The only topics that  could bridge the Core and Enterprise Java are
Sockets & Beans.
The JavaTM Platform

Most of you know there are three flavors of Java - Micro Edition,
Standard Edition, and Enterprise Edition. These three flavors of Java
represent three distinct target market segments each of which has
unique issues and requirements that need to be addressed somewhat
differently.
What is J2EE?
Sun's J2EE architecture is multi tiered architecture and
it eliminates all the problems of two-tier architecture.
It also eliminates the need of writing thin-client
multithread applications, which were earlier used to
write distributed transactional applications for the
enterprise.
Thin-client multi tiered applications are very fast,
secure and reliable. But writing the thin-client multi
tiered applications are not easy and it involves many
lines of complicated code to handle transaction and
state management, multithreading, resource pooling
and other complex low-level details.
What is J2EE?
In the Java TM 2 Platform, Enterprise Edition
(J2EE tm), low-level details are separated from
the business logic. Now the developers will
more concentrate on the business logic rather
than the low-level details. Low-level details are
managed by the application container of the
application server.
Need for Enterprise programming
A well designed enterprise application should meet the
following goals –
Robustness
Performance
Object Oriented design Principles
Avoid Complexity
Maintainable and Extensible
Easy to Test
Promote reuse
Support for the multiple client types
Portability
Advantages of J2EE
Specifically there are two major paths to develop
enterprise applications – first is .NET platform
suite by Microsoft and second J2EE by Sun. There
are lot of other companies also like BEA, IBM,
Oracle, etc. Having all these choices Java has a
great acceptance because of following advantages –
Platform Independence
Managed Objects
Reusability
Modularity
Platform Independence
Enterprise applications comprises of wide variety
of information which has to spread across many
different type of platforms.
Hence, it is essential to have a programming
language that is capable of running across the
different platforms and that is Java.
Managed Objects
The platform independent J2EE provides a
managed environment for component.
J2EE applications are container-centric.
Another important property of the J2EE
applications is the ease by which it can modify
and control the behavior of applications without
changing the codes.
Reusability
In the programming field, the code reuse is the
most important and desired feature. This can be
done by following ways –
To segregate an application’s requirements into
individual components.
To use object oriented technology to encapsulate
shared functionality.
Java uses both the ways.
Modularity
When we develop a complete server-side
application, the program get large and complex
very quickly. It is always best to break down the
application into various modules that are
individually responsible for a specific task. This
also makes the application much easier to
maintain and understand.
Enterprise Architecture Types
A software application composition can be
broken down into three logical layers –
User Interface – Presentation Layer
Processing – Business Rule Layer
Reading and Writing Data – Data Access Layer
Single – Tier Architecture
User Interface Some applications are
Processing
Reading/Writing
developed to run on a single
Data computer.
In these type of applications all
functionalities are embedded
with in the same layer, such
as user interface, processing,
data manipulation, etc.
Such type of architecture is
called single – tier systems.
Two – Tier Architecture
Before the invention of
it
PC’s, applications were m
b t
Su pu
In
developed to run on
mainframe based client-
Di
server environment O
sp
ut lay
pu
which used a “thin” t

client and “thick” server.


Because application was
predominantly run on Business Rule User
Data Access Interface
server side. On On
Server Clients
Layers of Two – Tier Architecture
User Interface Layer

Business Rule, Data Access Layer

The approach of these applications are centralized in


which multiple users are allowed to work
simultaneously. Clients provide only user interface
and rest of all the processes are run on server side.
All the services and data access provided by server
is shared by all the users working on the
application.
Three – Tier Architecture

Clients Application Server Database Server

In this type application logic is divided into three layers –


1. Presentation Layer – User Interface Tier
2. Business Logic Layer – Business Rule Tier
3. Data Layer – Data-Store Tier
Layers of Three – Tier Architecture
 User-Interface Tier – This
User Interface Layer tier handles the user
interface logic. This is
normally on the client side.
Business Rule Layer  Business Rule Tier – This
tier handles all of the
business rules logic and
Data Access Layer
validates user input from
user interface tier.
Data-Store Tier – This tier is concerned with the
storage and retrieval of data from databases.
Advantages of Three – Tier Architecture
 Moving business rule components to an application
server can boost performance.
 Multiple application servers can take advantage of
load balancing and improve system fault tolerance.
 Changes to business rule can migrate to a small
number of application servers instead of a large
number of workstations.
 This also provides better code encapsulation allowing
different people or even companies to implement each
tier.
Multi– Tier Architecture
UI
Oriented
Business
Rule

Clients Business Rule Application Server Database Server

 Presentation Layer – User Interface Tier


 Presentation Logic Layer – User Interface
Oriented Business Logic Tier
 Business Logic Layer – Business Rule Tier
 Data Layer – Data-Store Tier
Layers of Multi – Tier Architecture
1.This handles the UI logic, which
includes the actual presentation of
1 - User Interface Layer screens and collect information.
2.This layer handles business rule
logic that supports the UI. For
2-UI-Business Rule Layer example, validation of user input.
3.This is responsible for data
manipulation and integration. It
can combine data from SQL
3 - Business Rule Layer databases with flat files or even
Internet resources.
4.This layer handles the storage and
4 – Data Access Layer retrieval of data from databases,
files, and other data sources.
Advantages of Multi – Tier Architecture
 The central idea in multi-tier architecture is to keep the
services physically close to data they work with.
 Multi-tier architecture lets us put UI – Oriented business
rule components which are an excellent candidates for Java
Beans which let us to create reasonable, platform –
independent components.
 Data oriented business rule components are an excellent
candidates for Enterprise Java Beans (EJB) which provides
the facility of distributed programming.
 Multi – tier is a component based architecture. Therefore
business logic services that support the UI can remain
physically close to the client. Remaining application services
can scale as additional resources become available.
 The multi – tier architecture is flexible about the placement
and the presence of application servers.
J2EE Architecture
The J2EE Architecture allows the programmers to divide their
work into two major categories –
Presentation Logic
Presentation Logic consists of all the program (JSP and
Servlets), images and html files that are used to interact with
the client. These files are archived into .war file. These files are
installed on the web server and these interact with the users.
Business Logic
These are EJB applications which implement the business
logic of the system and are archived into .jar file. Business
logic runs on the application server.
These two types of archives are bundled into complete J2EE
applications, and delivered as Enterprise Archive (EAR) file.
A typical J2EE Environment
EJB Container

Enterprise
Client bean
Enterprise
bean
Enterprise
Enterprise Information
bean System
Client

Client (RDBMS,
Web
ERP,
Container
Legacy
Applications)
(Servlets,
JNDI,
JSP Pages,
Client JMS,
HTML, XML)
JavaMail

Client - Tier Middle-Tier EIS-Tier


J2EE Components
The J2EE platform is a distributed application
server environment, i.e. Java environment
comprises of following components –
A runtime infrastructure for managing and
hosting applications. All runtime applications are
located in this server.
A set of Java APIs to build applications. These Java
APIs describe the programming model for J2EE
applications. For example, Java Servlet
Technology, EJB Technology, JSP technology, etc.
J2EE Containers
Containers are the interface between a
component and the low-level platform-specific
functionality that supports the component.
Before a Web, enterprise bean, or application
client component can be executed, it must be
assembled into a J2EE application and deployed
into its container.
Container Types

The deployment process installs J2EE application


components in the J2EE containers illustrated in Figure
Container Types
J2EE server - The runtime portion of a J2EE product.
A J2EE server provides EJB and Web containers.
Enterprise JavaBeans (EJB) container - Manages the
execution of enterprise beans for J2EE applications.
Enterprise beans and their container run on the J2EE
server.
Web container - Manages the execution of JSP page
and Servlet components for J2EE applications. Web
components and their container run on the J2EE
server.
Container Types
Application client container - Manages the
execution of application client components.
Application clients and their container run on the
client.
Applet container - Manages the execution of
applets. Consists of a Web browser and Java Plug-in
running on the client together.
J2EE Technologies
J2EE Architecture consists of following
technologies:
Java Database Connectivity (JDBC)
Java Naming and Directory Interface (JNDI)
Enterprise Java Beans (EJB)
Java Server Pages (JSP)
Java Servlets
Remote Method Invocation (RMI)
Java IDL/CORBA

You might also like