0% found this document useful (0 votes)
31 views6 pages

IT8501 WT Topic23

Uploaded by

Fathima Vaheeth
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views6 pages

IT8501 WT Topic23

Uploaded by

Fathima Vaheeth
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 6

TOPIC WISE CLASS NOTES

Unit Number: III Topic Number: 23 Lecture Number: 23/45

Name of the Faculty / Designation : Mrs.S.Fathima Chandhini,Assistant Professor


Course : IT8501 – Web Technology
Program : B.Tech – Information Technology
Topics : Server-Side Programming: Java
Servlets- Architecture Overview

Resources required to handle the class :( VAK - Visuals, Audio, Kinesthetic.)

Visual PPT

Audio Live explanation

Kinesthetic Workbook

@Visual: What are you going to show the students to learn in the class? – Example: PPT, a
video with or without audio, a model, a demonstration, etc.

*Audio: What are you going to make the student listen in the class?
Example: You live explanation, a recorded audio, a video with audio

#Kinesthetic: What are you going to make the students do physically in the class?
Example: Use a workbook and make them work on it and learn by doing
_______________________________________________________________
$ as per the course plan and will vary based on the credits

Prepared By: S.Fathima Chandhini, Assistant Professor, Dept. of Information


Technology
1
STEP 1: LEARNING OUTCOMES:
Server-Side Programming: Java Servlets- Architecture
After the session, the student should be able to:
1. Explain the working principle of servlet for creating dynamic web application.
2. Analyze how servlet is used for effective implementation of dynamic web application.

STEP 2: ACQUISITION
(The subtopics under the main topic being handled are listed. Under each sub topic, the entire detail is to be
prepared. This helps in handling the class with focus and confidence).

SERVER SIDE PROGRAMMING: Java Servlets


The server side programming is the name given to all types of programs which run on the web server.
They process the user input, interact with the databases and control what content is served back to the
client as a response to his request. It is written in a number of programming languages including PHP,
NodeJS, Python,Servlet,JSP etc and has full access to the server’s OS and the programmer can chose
the language he/she wants to code in.Server-side programming is extremely useful as it helps to
efficiently deliver user-customised content, and thus enhance the user experience. It can also be used
to refine responses based on the user’s data (Data Analysis).

Servlet technology is used to create a web application (resides at server side and generates a dynamic
web page).Servlet technology is robust and scalable because of java language. Before Servlet, CGI
(Common Gateway Interface) scripting language was common as a server-side programming
language. However, there were many disadvantages to this technology. We have discussed these
disadvantages below. There are many interfaces and classes in the Servlet API such as Servlet,
GenericServlet, HttpServlet, ServletRequest, ServletResponse, etc.

3.9 Servlet Architecture Overview:


Servlet architecture comes under a java programming language used to create dynamic web
applications. Mainly servlets are used to develop server-side applications. Servlets are very robust and
scalable. Before introducing servlets CGI (common gateway interface) was used. Servlets are used to
perform client request and response tasks dynamically. Servlets can be used to perform tasks like,
o Control the flow of application.
o Generate dynamic web content.
o Server-side load balancing.
o implement business logic.
There are two types of Servlets-

Prepared By: S.Fathima Chandhini, Assistant Professor, Dept. of Information


Technology
1
1.Generic Servlets
2.HTTPServlets.
Servlets can be created in three possible ways
(i)Implementing Servlet Interface
(II)Extending Generic Servlet.
(III)Extending HTTPServlet.
Three life cycle methods available with servlets are init(), service() and destroy(). Every servlet
should override these methods.

3.9.1 Components of Servlet Architecture:


Below is the diagram to show how components working on servlet architecture.

Figure 3.7: Servlet Architecture

1. Client
In this architecture, the web browser acts as a Client. Client or user connected with a web browser.
The client is responsible for sending requests or HttpRequest to web server and processing responses
received by the Web server.
2. Web Server
Web server controls how web user access hosted files and its responsible for processing user request
and responses. Here server is a software it understand URLs and HTTP protocol. Whenever browser
need to host file on the webserver process client request using HTTP request, if it finds requested file
sends it back to browser through HTTP Response. There are two types’ web servers Static and
Dynamic webservers.in static web server sends the file as it is but in dynamic webserver hosted file is
updated before it is sent to the browser.
3. Web Container
Web container is the component in the webserver it interacts with Java servlets. A web container is
responsible for managing the lifecycle of servlets and it also performs the URL mapping task. Web
container handles the requests of servlets, JSP and other files at the server-side. The important tasks
performed by servlets are loading and unloading servlets, creating and managing requests and
response objects and performs the overall tsk of servlet management.

Prepared By: S.Fathima Chandhini, Assistant Professor, Dept. of Information


Technology
1
Servlet Request Flow

Following are the steps how servlet request has been processed consider the above diagram.
 The client sends a request.
 Web Server accepts the request and forwards it to the web container.
 Web container searches web.xml file for request URL pattern and gets the address of the
servlet.
 If the servlet is not yet instantiated it will be instantiated and initialized by calling the init()
method.
 The container calls public service() by passing ServletRequest and ServletResponse objects.
 Public service() method typecast ServletRequest and ServletResponse object to
HttpServletRequest and HttpServletResponse objects respectively.
 Public service() method calls protected service().
 Protected service() method checks the client request & corresponding do___() method is
called.
 Request is handled by sending the result generated by do___() to the client.
3.9.2 Advantages of Servlet Architecture
Below are some important advantages of the servlet as follows:
 Servlets are server independent, as they are compatible with any web server. Compared to
other server-side web technologies like ASP and JavaScript these are server-specific.
 Servlets are protocol-independent i.e. it supports FTP, SMTP, etc. Mainly it provides extended
support to HTTP protocol functionality.
 Servlets are persistent because it remains in memory until explicitly destroyed this helps in
several request processing and one database connection can handle several database requests.
 Servlets are portable since the servlets are written in java they are portable and supports any
web server.
 Faster in execution, servlets are compiled into byte code execute more quickly compared to
other scripting languages. Byte code conversion gives better performance and helps in type
checking and error.
3.9.3 Uses of Servlet Architecture
Let us see some of the uses of servlet that are given below:
1. Servlets are used to form data manipulation like accepting form data and generating dynamic
HTML pages.
2. Servlets helps in developing server load balancing applications. Where load balancing is
among different servers.
3. Servlets are used as the middle tier in enterprise network platforms for connecting the SQL
database.
4. Servlets can be integrated with applets to provide high-level interactivity and dynamic web
content generation.
5. Servlet is used to develop applications where this act as an active agent in the middle tier,
where they share data with each other.

Prepared By: S.Fathima Chandhini, Assistant Professor, Dept. of Information


Technology
1
6. Since the servlet supports various protocols like HTTP, FTF, etc. this helps in developing
applications like file server applications, chat enabled applications.
Compared to any other scripting languages Java servlets are better in performance in and these are
platform-independent. Servlets are dynamic in request and response processing. Since servlets
support various protocols hence servlets can be used while developing a web application to work with
different protocols. Overall servlets are best fit in developing dynamic web applications.

Prepared By: S.Fathima Chandhini, Assistant Professor, Dept. of Information


Technology
1
STEP 3: PRACTICE/TESTING
3. a. Short answer questions to check learning in the class

1. Servlet technology is used to create a ____________ web application.


2. Two types of Servlets are _______________
3. ___________ jar file is required to compile the servlet file.
4. _____________ is the component in the webserver it interacts with Java servlets.
5. _____________ server is used to run the servlet programs
6. Apache Tomcat is a web server.State True or False.

3. b. Questions to use in tests and examinations with CO and K level:


S.No Two Marks Questions RBT Course
Level Outcomes
1 What do you mean by Servlet? RBT-2 CO504.2
2 What is CGI and what are its drawbacks? RBT-2 CO504.2
3 What is a web container and what is its responsibility? RBT-2 CO504.2
4 What is war file? RBT-2 CO504.2
5 What is the workflow of a servlet?  RBT-2 CO504.2
6 What is Servlet Interface? RBT-2 CO504.2
Descriptive type questions
1 Discuss on servlet Architecture. RBT-2 CO504.2

Prepared By: S.Fathima Chandhini, Assistant Professor, Dept. of Information


Technology
1

You might also like