Title: Week 2 Lecture
1CCP111N Week4 Part2 Introduction to
J2EETraditional, 2 and 3 Tier
ArchitecturesIntroduction to J2EE
CCTM Course material developed by James King
(james.king_at_londonmet.ac.uk)
2Client-Server Architectures
- Traditional Program Architectures
- 2 - Tier Architecture
- 3 - Tier Architecture (popular)
- Which one is the right one?
CCTM Course material developed by James King
(james.king_at_londonmet.ac.uk)
3Traditional Program Architecture
- In a traditional programs the user interface is
closely coupled with the rest of the program. - The program must be installed on the client
machine - Any data the program needs is also saved and
loaded by the program on the machine it is
installed on. - Any processing of the data is performed by the
program on the machine it is installed on. - Internally the program may be divided up into
modules, objects, layers etc.
CCTM Course material developed by James King
(james.king_at_londonmet.ac.uk)
4Internet Programs and the Client Server Model
- The advent of the internet provided a new way of
structuring programs... - One such model is the client server model.
- This divides the program up into two parts
- One part is installed on the client and runs on
the client - One part is installed on the server and runs on
it - The exact division of tasks between the client
and server is up to the program developer - Typically servers are fast and reliable (and
expensive) and so important and complex tasks are
performed on them - Typically clients perform simple tasks and
interact with the user via a GUI
CCTM Course material developed by James King
(james.king_at_londonmet.ac.uk)
52-Tier Architecture Client Server
A 2-Tier architecture contains a presentation
tier and an applicationdata tier.
Application tier (server) performs processing on
behalf of the client and sends it the results to
display it is also responsible for any data
storage
Presentation tier or Client interacts with the
user and sends requests to the application layer
(server)
Network
CCTM Course material developed by James King
(james.king_at_londonmet.ac.uk)
6Example Web Browsing
- A classic example of the client server model is
the World Wide Web. Which relies on the Internet
to transfer data - A set of web servers hold HTML web pages on disk
and provide them to clients web browsers on
demand. - This is termed a 2 tier model because the web
server does not directly rely on other servers - The server is called the application tier
- The client is called the presentation tier
CCTM Course material developed by James King
(james.king_at_londonmet.ac.uk)
72 Tier Web Based Programs
- Modern web servers allow the user to write
programs which generate the HTML the client's web
browser will display. - This is still a two tier system because the
programs are under the control of the web browser
and are not independent of it. - The programs the web server runs are responsible
for doing the processing and data storage to
generate the web pages the server will send to
the client.
CCTM Course material developed by James King
(james.king_at_londonmet.ac.uk)
82 Tier Web Based Programs
- In Web program scenario, the browser provides a
universal user interface through client-side
technology (HTML, JavaScript) - The application runs on the server side to
handle client requests and ASP, JSP, Servlets or
other technologies generate the HTML
CCTM Course material developed by James King
(james.king_at_londonmet.ac.uk)
93-Tier Architecture
- Often the server requires considerable storage
for data or needs to interact with another
independent service. This creates a 3 Tier
program where the 3rd Tier is responsible for
data storage - Often the third Tier is on another server and is
accessed by the application Tier through a
network/Internet or via the Web
CCTM Course material developed by James King
(james.king_at_londonmet.ac.uk)
103-Tier Architecture
A 3-Tier architecture divides the server into two
parts a calculation server and a data storage
server (often a database)
Application tier Performs calculations on the
Data
Presentation tier Interacts with user
Data tier Stores Data
Network
Network
CCTM Course material developed by James King
(james.king_at_londonmet.ac.uk)
11Three-Tier Architecture Web Program
- Presentation tier on client side interacts with
the user directly by accepting and displaying
HTML using a browser (Netscape, IE etc.) - Application tier contains so called business
logic this is the processing required to
manipulate the data from the data Tier and
generate the HTML. It may transform the data and
perform calculations on it. Technologies include
Java Servlets, ASP, JSP, CGI etc. - Data tier stores the basic data often in a
database e.g. Oracle, Access. This is usually
stored in a application layer independent way
such as XML. - Many different programs may access the same data
layer just as many different web browsers may
interact with the application tier.
CCTM Course material developed by James King
(james.king_at_londonmet.ac.uk)
12Web Application Tier in More Detail
- The middle tier incorporates rules governing
interpretation of data which is application
dependant, processing logic for handling user
requests and extracting data from a database - A good application should be able to
- - handle multiple user requests efficiently
- - connect various data sources if needed
- - track sequences of requests from a client user
and their status - - handle security issues if needed
- Some Application Tier technologies
- CGI scripts
- - one of the earliest server-side options
(supported by most web servers) - - resource intensive a process created for
every request (heavy-weight processes) - ASP (HTML embedding VBScript or JavaScript)
- - currently available only on Windows only via
IIS (Microsoft) - Proprietary APIs from Netscape (NSAPI),
Microsoft Internet Server API - - normally written in C/C vendor specific,
fast - Java Servlets, Java Server pages (JSP) (Referred
to as J2EE) - - Wide support from Netscape, Sun, Apache,
Oracle, IBM runs on more than just Windows - - third party support (JRun)
CCTM Course material developed by James King
(james.king_at_londonmet.ac.uk)
13Application Tier in More Detail Business Logic
This is a fancy name for the code which
manipulates the data from the data Tier. The
middle tier incorporates rules governing
interpretation of data which is program and task
dependent. For example, the data-tier contains a
library data base and a list of users. The
business logic then specifies that the users with
books overdue will not be allowed to borrow new
books. The application for the middle tier should
implement this business logic.
CCTM Course material developed by James King
(james.king_at_londonmet.ac.uk)
142 Tier or 3 Tier?
- If you don't search store or Query any data you
have no need of the 3rd Tier - 2-Tier architecture can be faster because there
is no need to communicate requests to the 3rd
Tier and wait for its reply. However if you store
a lot of data why re invent the wheel. Databases
already exist!" - 3-Tier architecture can be slow due to an
additional level of communication. However,
database vendors (except Microsoft?) have spent a
lot of time optimizing their queries and
performance. You may also get better performance
because whilst the database is processing a
request the 2nd Tier can be processing a request
from another user. gt limited parallel commutation
CCTM Course material developed by James King
(james.king_at_londonmet.ac.uk)
15Introduction to J2EE technologies
CCTM Course material developed by James King
(james.king_at_londonmet.ac.uk)
16Java 2 Enterprise Edition (J2EE)
- J2EE is a collection of Application Programming
Interfaces - Some are available with the standard Java
Software development Kit and standard environment
J2SE, some are specific to the J2EE - The technologies are design to help develop 2 and
3 Tier programs with a emphasis on Web based
programs - J2EE includes
- Java Servlets
- Java Server Pages
- Java Beans
- Java Database Connectivity
- Extensible Markup Language
- Etc....
Covered in this course
CCTM Course material developed by James King
(james.king_at_londonmet.ac.uk)
17Java Server Pages (JSP)
Java Server Pages allows the developers to embed
the java code into html pages. It is a means by
which dynamic content can be generated using the
static HTML pages and the data from the database.
JSP specification are extension of Servlet API.
Java Servlets
Java Servlets are Java classes which can run on a
web server. They provide a powerful mechanism for
developing server-side applications. Servlets are
responsible for generating HTML in response to a
request from a client web browser.
CCTM Course material developed by James King
(james.king_at_londonmet.ac.uk)
18Java Beans
- Java beans allow you to remove most of the
functionality from a Servlet or JSP and place it
into separate classes. These classes run on the
web server and can be reused and shared between
JSP pages and Servlets
CCTM Course material developed by James King
(james.king_at_londonmet.ac.uk)
19Java Database Connectivity (JDBC)
JDBC allows Java programs to access any type of
database (if it has JDBC drivers) without knowing
the particular implementation of database. This
means programmer is not locked to one specific
database vendor. The vendor of the database can
be change with minor changes in the Java code.
XML
Extensible Markup Language provides a standard
structure to store data. This is ideal for the
exchange of data over the Internet where the
machine you exchange data with may have different
formats for data such as numbers.
CCTM Course material developed by James King
(james.king_at_londonmet.ac.uk)