0% found this document useful (0 votes)
23 views5 pages

Aj 20 May

Advanced Java Cyantesh sir

Uploaded by

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

Aj 20 May

Advanced Java Cyantesh sir

Uploaded by

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

Dt : 20/5/2022

Execution flow of above application:

http://localhost:8082/Servlet_App1/

ii
ath
ServletContext:
aip
hM
=>ServletContext is an interface from javax.servlet package

and which is instantiated automatically when the WebApp is

deployed on to Server.
tes

=>This ServletContext object is loaded with Server information.


a

ServletConfig:
nk

=>ServletConfig is an interface from javax.servlet package and


Ve

which is instantiated automatically when the Servlet program is

loaded onto WebContainer for execution.

=>This ServletConfig object is loaded with Servlet name.

ServletRequest:

=>ServletRequest is an interface from javax.servlet package


and which is instantiated automatically while service() method

execution.

=>ServletRequest object will hold the data submitted from HTML

form.

ServletResponse:

ii
=>ServletResponse is an interface from javax.servlet package

ath
and which is also instantiated automatically whil service()

method execution.

=>ServletResponse object will hold the data which is sent as

aip
response.
hM
faq:

define getWriter() method?

=>getWriter() method is from ServletResponse and which is


tes

used to create object for 'java.io.PrintWriter' class.


a

syntax:
nk

PrintWriter pw = res.getWriter();

=>using PrinterWriter object we send the data as response.


Ve

faq:

define setContentType() method?

=>setContentType() method is also from ServletResponse and

which specify the type of data sent as response.


syntax:

res.setContentType("text/html");

=========================================================

Assignment-1:

Construct Servlet Application to read and display Product details?

ii
ath
Assignment-2:

Construct Servlet Application to read and display Book Details?

aip
Assignment-3:

Construct Servlet Application to read and display Employee


hM
Details?

Note:
tes

Draw the execution flows for above applications

=========================================================
a

*imp
nk

RequestDispatcher:

=>RequestDispatcher is an interface from javax.servlet package


Ve

and which is used perform Servlet Communications.

=>This RequestDispatcher will provide the following two methods

to perform Servlet Communications

(i)forward()

(ii)include()
(i)forward():

=>forward() method is used to perform forward communication

process.

=>In forward communication process FisrtServlet will take the

request and forwards the request to SecondServlet,in this process

ii
SecondServlet will give the response.

ath
(SecondServlet can be replaced by JSP or HTML)

Diagram:

aip
hM
a tes
nk

(ii)include():
Ve

=>include() method is used to perform include communication

process.

=>In include Communication process FirstServlet will take the

request and generate response,but the response is included

with the response of SecondServlet.


(SecondServlet can be replaced by JSP or HTML)

Diagram:

ii
ath
aip
hM
======================================================
a tes
nk
Ve

You might also like