EAD Lecture 2-3

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

Intro to J2EE Concepts

J2EE Introduction

What does J2EE stand for


What is its purpose
Why should I learn to develop Web Applications using J2EE technologies
What is J2EE (or JEE)
Short for Java 2 Platform Enterprise Edition.
J2EE is a platform-independent, Java-centric environment from Sun/Oracle for developing,
building and deploying Web-based enterprise applications online.
The J2EE platform consists of a set of services, APIs, and protocols that provide the functionality
for developing multi-tiered, Web-based applications.
Java: Broadest Industry Adoption

9,000,000
JAVA DEVELOPERS
DEPLOYING TO 18 COMPLIANT APPLICATION SERVERS
Differences between Java EE and Java SE

Java technology is both a programming language and a platform.


The Java programming language is a high-level object-oriented language that has a particular
syntax and style.
A Java platform is a particular environment in which Java programming language applications
run.
There are several Java platforms.
Many developers, even long-time Java programming language developers, do not understand
how the different platforms relate to each other.
Java SE

When most people think of the Java programming language, they think of the Java SE API.
Java SE's API provides the core functionality of the Java programming language.
It defines everything from the basic types and objects of the Java programming language to
high-level classes that are used for networking, security, database access, graphical user
interface (GUI) development, and XML parsing.
In addition to the core API, the Java SE platform consists of a virtual machine, development
tools, deployment technologies, and other class libraries and toolkits commonly used in Java
technology applications.
Java EE
The Java EE platform is built on top of the Java SE platform.
The Java EE platform provides an API and runtime environment for developing and running
◦ large-scale
◦ multi-tiered
◦ scalable
◦ reliable
◦ secure network applications
A glance at J2EE architecture
Distributed Multi-tiered Applications

The Java EE platform uses a distributed Multi-tiered application model for enterprise
applications.
Application logic is divided into components according to function
The application components that make up a Java EE application are installed on various
machines depending on the tier in the Multi-tiered Java EE environment to which the
application component belongs.
Multi-tiered Applications
Three-tiered Applications
Although a Java EE application can consist of all tiers shown in the prior slide, Java EE Multi-
tiered applications are generally considered to be three-tiered applications because they are
distributed over three locations:
1. Client machines
2. The Java EE server machine, and the database or legacy machines at the back end.
3. Three-tiered applications that run in this way extend the standard two-tiered client-and-server
model by placing a multithreaded application server between the client application and back-end
storage.
Java EE Components

Java EE applications are made up of components.


A Java EE component is
◦ a self-contained functional software unit that
◦ is assembled into a Java EE application with its related classes and files
◦ communicates with other components.

The Java EE specification defines the following Java EE components:


◦ Application clients and applets are components that run on the client.
◦ Java Servlet, JavaServer Faces, and JavaServer Pages (JSP) technology components are web
components that run on the server.
◦ EJB components (enterprise beans) are business components that run on the server.
Java EE Components

Java EE components are written in the Java programming language and are compiled
in the same way as any program in the language.
The differences between Java EE components and "standard" Java classes:
◦ Java EE components are assembled into a Java EE application
◦ they are verified to be well formed and in compliance with the Java EE specification
◦ they are deployed to production, where they are run and managed by the Java EE server.
Java EE Components
Client-tier components run on the client machine.
Web-tier components run on the Java EE server.
Business-tier components run on the Java EE server.
Enterprise information system (EIS)-tier software runs on the EIS server.
Java EE Clients

A Java EE client is usually either a web client or an application client.


Web Clients
A web client consists of two parts:
◦ Dynamic web pages containing various types of markup language (HTML, XML, and so on), which are
generated by web components running in the web tier
◦ A web browser, which renders the pages received from the server

A web client is sometimes called a thin client.


Thin clients usually do not query databases, execute complex business rules, or connect to
legacy applications.
When you use a thin client, such heavyweight operations are off-loaded to enterprise beans
executing on the Java EE server, where they can leverage the security, speed, services, and
reliability of Java EE server-side technologies.
Application Clients
An application client runs on a client machine and provides a way for users to handle tasks that
require a richer user interface than can be provided by a markup language.
An application client typically has a graphical user interface (GUI) created from the Swing API or
the Abstract Window Toolkit (AWT) API, but a command-line interface is certainly possible.
Application clients directly access enterprise beans running in the business tier.
However, if application requirements warrant it, an application client can open an HTTP
connection to establish communication with a servlet running in the web tier.
Application clients written in languages other than Java can interact with Java EE servers,
enabling the Java EE platform to interoperate with legacy systems, clients, and non-Java
languages.
JavaBeans Component Architecture

The server and client tiers might also include components based on the JavaBeans component
architecture (JavaBeans components) to manage the data flow between the following:
◦ An application client or applet and components running on the Java EE server
◦ Server components and a database

JavaBeans Components have get() and set() methods for accessing those properties.
JavaBeans components used in this way are typically simple in design and implementation
Should conform to the naming and design conventions outlined in the JavaBeans component
architecture.
Java EE Server Communications

Shows the various elements that can make up the client tier.
The client communicates with the business tier running on the Java EE server
◦ either directly or, as in the case of a client running in a browser
◦ by going through web pages or
◦ servlets running in the web tier.
Web Components

Java EE web components are either servlets or web pages created using JavaServer Faces technology
and/or JSP technology (JSP pages).
Servlets are Java programming language classes that dynamically process requests and construct
responses.
JSP pages are text-based documents that execute as servlets but allow a more natural approach to
creating static content.
JavaServer Faces technology builds on servlets and JSP technology and provides a user interface
component framework for web applications.
Static HTML pages and applets are bundled with web components during application assembly but are
not considered web components by the Java EE specification.
Server-side utility classes can also be bundled with web components and, like HTML pages, are not
considered web components.
Web Tier and Java EE Applications
The web tier, like the client tier, might include a
JavaBeans component to
manage the user input and send that input to
enterprise beans running
in the business tier for processing.
Business Components
Business code, which is logic that solves or meets the needs of a particular business domain
such as banking, retail, or finance, is handled by enterprise beans running in either the business
tier or the web tier.
An enterprise bean receives data from client programs, processes it (if necessary), and sends it
to the enterprise information system tier for storage.
An enterprise bean also retrieves data from storage, processes it (if necessary), and sends it
back to the client program.
Business and EIS Tiers
Enterprise Information System Tier
The enterprise information system tier handles EIS software and includes enterprise
infrastructure systems, such as
◦ enterprise resource planning (ERP)
◦ mainframe transaction processing, database systems
◦ other legacy information systems

For example, Java EE application components might need access to enterprise information
systems for database connectivity.
Java EE Containers
Normally, thin-client Multi-tiered applications are hard to write because they involve many lines of
intricate code to handle
◦ transaction and state management
◦ multithreading
◦ resource pooling
◦ other complex low-level details.

The component-based and platform-independent Java EE architecture makes applications easy to


write because business logic is organized into reusable components.
In addition, the Java EE server provides underlying services in the form of a container for every
component type.
Because you do not have to develop these services yourself, you are free to concentrate on solving
the business problem at hand.
A glance at J2EE architecture
Containers provide services for :
◦ Security
◦ Transaction
◦ Persistence
◦ Concurrency
◦ Availability
◦ Lifecycle Management
Container Services

Containers are the interface between a component and the low-level, platform-specific
functionality that supports the component.
Before it can be executed, a web, enterprise bean, or application client component must be
assembled into a Java EE module and deployed into its container.
The assembly process involves specifying container settings for each component in the Java EE
application and for the Java EE application itself.
Container settings customize the underlying support provided by the Java EE server, including
such services as
◦ security
◦ transaction management
◦ Java Naming and Directory Interface (JNDI) API lookups
◦ remote connectivity.
Container Services

The Java EE security model lets you configure a web component or enterprise bean so that system
resources are accessed only by authorized users.
The Java EE transaction model lets you specify relationships among methods that make up a single
transaction so that all methods in one transaction are treated as a single unit.
JNDI lookup services provide a unified interface to multiple naming and directory services in the
enterprise so that application components can access these services.
The Java EE remote connectivity model manages low-level communications between clients and
enterprise beans.
After an enterprise bean is created, a client invokes methods on it as if it were in the same virtual
machine.
Container Services

Because the Java EE architecture provides configurable services, components within the same
application can behave differently based on where they are deployed.
For example, an enterprise bean can have security settings that allow it a certain level of access
to database data in one production environment and another level of database access in
another production environment.
The container also manages non-configurable services such as
◦ enterprise bean and servlet lifecycles,
◦ database connection resource pooling,
◦ data persistence,
◦ access to the Java EE platform APIs
Container Types

The deployment process installs Java EE


application components in the Java EE
containers
Servers and Containers
Java EE server: The runtime portion of a Java EE product. A Java EE server provides EJB and web
containers.
EJB container: Manages the execution of enterprise beans for Java EE applications. Enterprise
beans and their container run on the Java EE server.
Web container: Manages the execution of web pages, servlets, and some EJB components for
Java EE applications. Web components and their container run on the Java EE server.
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 a Java Plug-
in running on the client together.
J2EE Development Lifecycle
Develop components for
◦ Persistence (Entities)
◦ Business Logic (EJBs)
◦ Presentation (JSF, XHTML)
◦ Configure/Prepare deployment descriptors

Build Components in packages (JARs, WARs, EARs)


Deploy packages on Container (J2EE Server)
Java EE Application Assembly and Deployment

A Java EE application is packaged into one or more standard units for deployment to any Java EE
platform-compliant system.
Each unit contains
◦ A functional component or components, such as an enterprise bean, web page, servlet, or applet
◦ An optional deployment descriptor that describes its content

Once a Java EE unit has been produced, it is ready to be deployed.


Deployment typically involves using a platform's deployment tool to specify location-specific
information, such as a list of local users who can access it and the name of the local database.
Once deployed on a local platform, the application is ready to run.
J2EE Technologies
Java Persistence API (JPA)
Enterprise Java Beans (EJB)
eXtended Markup Language (XML)
Java Server Faces (JSF)
eXtensible HyperText Markup Language(XHTML)
Other Related Technologies
Cascading Style Sheets (CSS)
JavaScript & Jquery
Ajax
Dependency Injection Frameworks
EJB Overview
What is EJB?
◦ A platform for building portable, reusable, and scalable business applications using Java
◦ A piece of Java code that executes in a specialized runtime environment called the EJB container
◦ EJB is both a component and a framework
EJB Overview

EJB as a component
◦ Persistence
◦ Entity Beans
◦ Business Logic
◦ Session Beans
◦ Message Driven Beans
EJB Overview
EJB as a framework
◦ Out of the box services
◦ Available to all components during execution via EJB Container
◦ Annotations : The magic wand
◦ Specify services, types and behavior
◦ Service Oriented Architecture
◦ Fast and easy Web Service Creation
JSF Overview

What is Java Server Faces


◦ A component architecture
◦ A standard – extendable set of UI Widgets
◦ An application infrastructure

Basic Characteristics
◦ Event oriented components
◦ Powerful architectures for different Uis (desktop browsers, mobile devices etc.)
◦ Flexible Navigation System
JSF Overview
Basic Characteristics
◦ Synchronization with Java Objects through backing beans
◦ Internationalization
◦ Validators & Converters
◦ Several popular implementations
◦ RichFaces
◦ IceFaces
◦ PrimeFaces
XHTML Overview

Why XHTML instead of HTML


◦ A more clean and standard way to write HTML
◦ Take advantages of all XML goodies
◦ Allows a larger percentage of browsers or code parsers to properly parse pages
◦ Use of Templates to facilitate page reusability and “inheritance”
XHTML Overview
Differences with HTML
◦ XHTML elements must be properly nested
◦ XHTML elements must always be closed
◦ XHTML elements must be in lowercase
◦ XHTML documents must have one root element
◦ Documents can be validated much easier
XHTML Overview

Documents can be transformed via tools like XSLT into other documents for consumption by
devices like handhelds
Fragments of documents can be retrieved faster
Text can be stored more efficiently in object oriented databases
J2EE Introduction
Taken from a presentation by Papapetrou P. Patroklos
Supplemented by Oracle’s J2EE 7 Tutorial

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy