Server Side Programmin g I Servlet Funda
MODUL PERKULIAHAN
Server-Side
Programmin
gI
Servlet
Fundamenta
ls
Arsitektur E-Bisnis
Fakultas
Program Studi
Tatap eMuka
Ilmu Komputer
Sistem Informasi
04
Abstract
Kode MK
Disusun Oleh
Misbahul Fajri, ST., MTI
Kompetensi
Outline
Common server-side programming techniques
Revisiting the Three-tier Model
Web-based e-commerce applications are usually built according to the “Three-tier Model” (Fig. 4.1),
which includes:
The First-tier: Web Client
Discussed in Chapter 3
The Second-tier: Server-side Application (SSA)
Discussed in this chapter
The Third-tier: Database Management Systems (DBMS)
Discussed in Chapter 5
Three-Tier Model (Fig. 4.1)
‘1
3
2
Arsitektur E-Bisnis
Misbahul Fajri, ST., MTI
Pusat Bahan Ajar dan eLearning
http://www.mercubuana.ac.id
First-tier : Web
Clients
Client Client Client
Brows Brows Brows
er
er
er
Third-tier
(DBMS) :
DB2
Database
data
S
Cluster(s) base
QL
Databa
s
Se
se
Other
Internet
Second-tier :
Server-side Web
Applications
Web
Server
Applica
tion
Server
Databa
se
Conne
ctivity
rvOracl
datab
er e
Clusterases
datab
ases
Server-side programming
technologies
There are numerous ways to implement server-side applications. Common examples include:
CGI (Common Gateway Interface)
ASP (Active Server Page)
Java Servlets
PHP, Perl, & other server programming languages
‘1
3
3
Arsitektur E-Bisnis
Misbahul Fajri, ST., MTI
Pusat Bahan Ajar dan eLearning
http://www.mercubuana.ac.id
Common Gateway Interface (CGI)
Early Web page designs were “static” in the sense that a client can only request for a static
HTML document from the Web server (Fig. 4.2).
Later, CGI programming techniques were introduced to remove this constraint by providing
dynamic Web pages via server-side interaction, as shown in Fig. 4.3.
Static Web Page Retrieval (Fig. 4.2)
Request
for
Web
Document
HTTP Request
HTTP
Web Browser
Document
Web Server
Retrieve
Document
CGI-based Web Application (Fig. 4.3)
‘1
3
4
Arsitektur E-Bisnis
Misbahul Fajri, ST., MTI
Pusat Bahan Ajar dan eLearning
http://www.mercubuana.ac.id
Web
Documents
HTTP Request
Web
Browser
HTTP
Document
Web Server
Output
(HTML)
HTML forms
to invoke CGI
scripts
CGI Scripts/
Applications
Get Data
Return data
Databas
e
Common Gateway Interface (CGI)
Fig. 4.3 explains the retrieval of a static Web page. The Web browser goes to the designated
URL on a specific Web server to retrieve the required static HTML document when it receives
a client request.
Note the content is independent of the request, in the sense, everyone who makes a request
to that particular URL gets the same document.
Active Server Page (ASP)
ASP is a "scripting" technique that runs on Web servers rather than Web clients.This
contrasts with VBScript and JavaScript which run on web clients.
It basically generates HTML documents for the Web client.
Execution of the ASP code by the server returns the corresponding HTML document to the
client.
Fig. 4.4 shows the schematic diagram of ASP model.
‘1
3
5
Arsitektur E-Bisnis
Misbahul Fajri, ST., MTI
Pusat Bahan Ajar dan eLearning
http://www.mercubuana.ac.id
ASP Model (Fig. 4.4)
ASP Engine
HTTP Request
HTTP Document
Web Browser
Web Server
Database
Disadvantages of CGI programs
Each new request activates a new process to run the CGI program
Creating a process requires time and resource so CGI programs is not as scaleable a solution
Also, CGI programs may raise security problems
Java Servlet
A servlet is a small piece of server-side application, which can be viewed as the server-side
analog of an applet.
In a typical servlet application, a servlet-enabled Web server receives an HTTP request from
the client.
‘1
3
6
Arsitektur E-Bisnis
Misbahul Fajri, ST., MTI
Pusat Bahan Ajar dan eLearning
http://www.mercubuana.ac.id
It then forwards the request to the servlet engine for performing the necessary operations as
specified by the program.
Finally it returns a response (e.g., HTML document) to the client via the Web server (Fig. 4.5)
Typical Web-based Servlet Interaction (Fig. 4.5)
HTTP Request
Web
Browser
HTTP Response
Web Server
Servlet
Engine
Databa
se
Revisiting the Three-tier Model
Web-based e-commerce applications are usually built according to the “Three-tier Model” (Fig. 4.1),
which includes:
The First-tier: Web Client
Discussed in Chapter 3
The Second-tier: Server-side Application (SSA)
Discussed in this chapter
The Third-tier: Database Management Systems (DBMS)
Discussed in Chapter 5
‘1
3
7
Arsitektur E-Bisnis
Misbahul Fajri, ST., MTI
Pusat Bahan Ajar dan eLearning
http://www.mercubuana.ac.id
Three-Tier Model (Fig. 4.1)
First-tier : Web
Clients
Client Client Client
Brows Brows Brows
er
er
er
Third-tier
(DBMS) :
DB2
Database
data
S
Cluster(s)
base
QL
Databa
s
Se
se
Other
Internet
Second-tier :
Server-side Web
Applications
Web
Server
Applica
tion
Server
Databa
se
Conne
ctivity
rvOracl
datab
er e
Clusterases
datab
ases
Server-side programming
technologies
There are numerous ways to implement server-side applications. Common examples include:
CGI (Common Gateway Interface)
ASP (Active Server Page)
Java Servlets
PHP, Perl, & other server programming languages
‘1
3
8
Arsitektur E-Bisnis
Misbahul Fajri, ST., MTI
Pusat Bahan Ajar dan eLearning
http://www.mercubuana.ac.id
Common Gateway Interface (CGI)
Early Web page designs were “static” in the sense that a client can only request for a static
HTML document from the Web server (Fig. 4.2).
Later, CGI programming techniques were introduced to remove this constraint by providing
dynamic Web pages via server-side interaction, as shown in Fig. 4.3.
Static Web Page Retrieval (Fig. 4.2)
Request
for
Web
Document
HTTP Request
HTTP
Web Browser
Document
Web Server
Retrieve
Document
CGI-based Web Application (Fig. 4.3)
‘1
3
9
Arsitektur E-Bisnis
Misbahul Fajri, ST., MTI
Pusat Bahan Ajar dan eLearning
http://www.mercubuana.ac.id
Web
Documents
HTTP Request
Web
Browser
HTTP
Document
Web Server
Output
(HTML)
HTML forms
to invoke CGI
scripts
CGI Scripts/
Applications
Get Data
Return data
Databas
e
Common Gateway Interface (CGI)
Fig. 4.3 explains the retrieval of a static Web page. The Web browser goes to the designated
URL on a specific Web server to retrieve the required static HTML document when it receives
a client request.
Note the content is independent of the request, in the sense, everyone who makes a request
to that particular URL gets the same document.
Active Server Page (ASP)
ASP is a "scripting" technique that runs on Web servers rather than Web clients.This
contrasts with VBScript and JavaScript which run on web clients.
It basically generates HTML documents for the Web client.
Execution of the ASP code by the server returns the corresponding HTML document to the
client.
Fig. 4.4 shows the schematic diagram of ASP model.
‘1
3
10
Arsitektur E-Bisnis
Misbahul Fajri, ST., MTI
Pusat Bahan Ajar dan eLearning
http://www.mercubuana.ac.id
ASP Model (Fig. 4.4)
ASP Engine
HTTP Request
HTTP Document
Web Browser
Web Server
Database
Disadvantages of CGI programs
Each new request activates a new process to run the CGI program
Creating a process requires time and resource so CGI programs is not as scaleable a solution
Also, CGI programs may raise security problems
Java Servlet
A servlet is a small piece of server-side application, which can be viewed as the server-side
analog of an applet.
In a typical servlet application, a servlet-enabled Web server receives an HTTP request from
the client.
‘1
3
11
Arsitektur E-Bisnis
Misbahul Fajri, ST., MTI
Pusat Bahan Ajar dan eLearning
http://www.mercubuana.ac.id
It then forwards the request to the servlet engine for performing the necessary operations as
specified by the program.
Finally it returns a response (e.g., HTML document) to the client via the Web server (Fig. 4.5)
Daftar Pustaka
•
‘1
3
E-Commerce Fundamental & Application, Wiley 2001
12
Arsitektur E-Bisnis
Misbahul Fajri, ST., MTI
Pusat Bahan Ajar dan eLearning
http://www.mercubuana.ac.id
Server-Side
Programmin
gI
Servlet
Fundamenta
ls
Arsitektur E-Bisnis
Fakultas
Program Studi
Tatap eMuka
Ilmu Komputer
Sistem Informasi
04
Abstract
Kode MK
Disusun Oleh
Misbahul Fajri, ST., MTI
Kompetensi
Outline
Common server-side programming techniques
Revisiting the Three-tier Model
Web-based e-commerce applications are usually built according to the “Three-tier Model” (Fig. 4.1),
which includes:
The First-tier: Web Client
Discussed in Chapter 3
The Second-tier: Server-side Application (SSA)
Discussed in this chapter
The Third-tier: Database Management Systems (DBMS)
Discussed in Chapter 5
Three-Tier Model (Fig. 4.1)
‘1
3
2
Arsitektur E-Bisnis
Misbahul Fajri, ST., MTI
Pusat Bahan Ajar dan eLearning
http://www.mercubuana.ac.id
First-tier : Web
Clients
Client Client Client
Brows Brows Brows
er
er
er
Third-tier
(DBMS) :
DB2
Database
data
S
Cluster(s) base
QL
Databa
s
Se
se
Other
Internet
Second-tier :
Server-side Web
Applications
Web
Server
Applica
tion
Server
Databa
se
Conne
ctivity
rvOracl
datab
er e
Clusterases
datab
ases
Server-side programming
technologies
There are numerous ways to implement server-side applications. Common examples include:
CGI (Common Gateway Interface)
ASP (Active Server Page)
Java Servlets
PHP, Perl, & other server programming languages
‘1
3
3
Arsitektur E-Bisnis
Misbahul Fajri, ST., MTI
Pusat Bahan Ajar dan eLearning
http://www.mercubuana.ac.id
Common Gateway Interface (CGI)
Early Web page designs were “static” in the sense that a client can only request for a static
HTML document from the Web server (Fig. 4.2).
Later, CGI programming techniques were introduced to remove this constraint by providing
dynamic Web pages via server-side interaction, as shown in Fig. 4.3.
Static Web Page Retrieval (Fig. 4.2)
Request
for
Web
Document
HTTP Request
HTTP
Web Browser
Document
Web Server
Retrieve
Document
CGI-based Web Application (Fig. 4.3)
‘1
3
4
Arsitektur E-Bisnis
Misbahul Fajri, ST., MTI
Pusat Bahan Ajar dan eLearning
http://www.mercubuana.ac.id
Web
Documents
HTTP Request
Web
Browser
HTTP
Document
Web Server
Output
(HTML)
HTML forms
to invoke CGI
scripts
CGI Scripts/
Applications
Get Data
Return data
Databas
e
Common Gateway Interface (CGI)
Fig. 4.3 explains the retrieval of a static Web page. The Web browser goes to the designated
URL on a specific Web server to retrieve the required static HTML document when it receives
a client request.
Note the content is independent of the request, in the sense, everyone who makes a request
to that particular URL gets the same document.
Active Server Page (ASP)
ASP is a "scripting" technique that runs on Web servers rather than Web clients.This
contrasts with VBScript and JavaScript which run on web clients.
It basically generates HTML documents for the Web client.
Execution of the ASP code by the server returns the corresponding HTML document to the
client.
Fig. 4.4 shows the schematic diagram of ASP model.
‘1
3
5
Arsitektur E-Bisnis
Misbahul Fajri, ST., MTI
Pusat Bahan Ajar dan eLearning
http://www.mercubuana.ac.id
ASP Model (Fig. 4.4)
ASP Engine
HTTP Request
HTTP Document
Web Browser
Web Server
Database
Disadvantages of CGI programs
Each new request activates a new process to run the CGI program
Creating a process requires time and resource so CGI programs is not as scaleable a solution
Also, CGI programs may raise security problems
Java Servlet
A servlet is a small piece of server-side application, which can be viewed as the server-side
analog of an applet.
In a typical servlet application, a servlet-enabled Web server receives an HTTP request from
the client.
‘1
3
6
Arsitektur E-Bisnis
Misbahul Fajri, ST., MTI
Pusat Bahan Ajar dan eLearning
http://www.mercubuana.ac.id
It then forwards the request to the servlet engine for performing the necessary operations as
specified by the program.
Finally it returns a response (e.g., HTML document) to the client via the Web server (Fig. 4.5)
Typical Web-based Servlet Interaction (Fig. 4.5)
HTTP Request
Web
Browser
HTTP Response
Web Server
Servlet
Engine
Databa
se
Revisiting the Three-tier Model
Web-based e-commerce applications are usually built according to the “Three-tier Model” (Fig. 4.1),
which includes:
The First-tier: Web Client
Discussed in Chapter 3
The Second-tier: Server-side Application (SSA)
Discussed in this chapter
The Third-tier: Database Management Systems (DBMS)
Discussed in Chapter 5
‘1
3
7
Arsitektur E-Bisnis
Misbahul Fajri, ST., MTI
Pusat Bahan Ajar dan eLearning
http://www.mercubuana.ac.id
Three-Tier Model (Fig. 4.1)
First-tier : Web
Clients
Client Client Client
Brows Brows Brows
er
er
er
Third-tier
(DBMS) :
DB2
Database
data
S
Cluster(s)
base
QL
Databa
s
Se
se
Other
Internet
Second-tier :
Server-side Web
Applications
Web
Server
Applica
tion
Server
Databa
se
Conne
ctivity
rvOracl
datab
er e
Clusterases
datab
ases
Server-side programming
technologies
There are numerous ways to implement server-side applications. Common examples include:
CGI (Common Gateway Interface)
ASP (Active Server Page)
Java Servlets
PHP, Perl, & other server programming languages
‘1
3
8
Arsitektur E-Bisnis
Misbahul Fajri, ST., MTI
Pusat Bahan Ajar dan eLearning
http://www.mercubuana.ac.id
Common Gateway Interface (CGI)
Early Web page designs were “static” in the sense that a client can only request for a static
HTML document from the Web server (Fig. 4.2).
Later, CGI programming techniques were introduced to remove this constraint by providing
dynamic Web pages via server-side interaction, as shown in Fig. 4.3.
Static Web Page Retrieval (Fig. 4.2)
Request
for
Web
Document
HTTP Request
HTTP
Web Browser
Document
Web Server
Retrieve
Document
CGI-based Web Application (Fig. 4.3)
‘1
3
9
Arsitektur E-Bisnis
Misbahul Fajri, ST., MTI
Pusat Bahan Ajar dan eLearning
http://www.mercubuana.ac.id
Web
Documents
HTTP Request
Web
Browser
HTTP
Document
Web Server
Output
(HTML)
HTML forms
to invoke CGI
scripts
CGI Scripts/
Applications
Get Data
Return data
Databas
e
Common Gateway Interface (CGI)
Fig. 4.3 explains the retrieval of a static Web page. The Web browser goes to the designated
URL on a specific Web server to retrieve the required static HTML document when it receives
a client request.
Note the content is independent of the request, in the sense, everyone who makes a request
to that particular URL gets the same document.
Active Server Page (ASP)
ASP is a "scripting" technique that runs on Web servers rather than Web clients.This
contrasts with VBScript and JavaScript which run on web clients.
It basically generates HTML documents for the Web client.
Execution of the ASP code by the server returns the corresponding HTML document to the
client.
Fig. 4.4 shows the schematic diagram of ASP model.
‘1
3
10
Arsitektur E-Bisnis
Misbahul Fajri, ST., MTI
Pusat Bahan Ajar dan eLearning
http://www.mercubuana.ac.id
ASP Model (Fig. 4.4)
ASP Engine
HTTP Request
HTTP Document
Web Browser
Web Server
Database
Disadvantages of CGI programs
Each new request activates a new process to run the CGI program
Creating a process requires time and resource so CGI programs is not as scaleable a solution
Also, CGI programs may raise security problems
Java Servlet
A servlet is a small piece of server-side application, which can be viewed as the server-side
analog of an applet.
In a typical servlet application, a servlet-enabled Web server receives an HTTP request from
the client.
‘1
3
11
Arsitektur E-Bisnis
Misbahul Fajri, ST., MTI
Pusat Bahan Ajar dan eLearning
http://www.mercubuana.ac.id
It then forwards the request to the servlet engine for performing the necessary operations as
specified by the program.
Finally it returns a response (e.g., HTML document) to the client via the Web server (Fig. 4.5)
Daftar Pustaka
•
‘1
3
E-Commerce Fundamental & Application, Wiley 2001
12
Arsitektur E-Bisnis
Misbahul Fajri, ST., MTI
Pusat Bahan Ajar dan eLearning
http://www.mercubuana.ac.id