Professional Documents
Culture Documents
Web Technologies: Requestdispatcher in Servlet
Web Technologies: Requestdispatcher in Servlet
Web Technologies: Requestdispatcher in Servlet
RequestDispatcher in Servlet
Wasif Hamdani
RequestDispatcher
2
RequestDispatcher
Methods of RequestDispatcher interface:
3
RequestDispatcher
Methods of RequestDispatcher interface:
4
RequestDispatcher
5
RequestDispatcher
Methods of RequestDispatcher interface:
6
RequestDispatcher
Methods of RequestDispatcher interface:
7
RequestDispatcher
8
RequestDispatcher
Methods of RequestDispatcher interface:
9
RequestDispatcher
How to get the object of RequestDispatcher?
Syntax:
10
RequestDispatcher
How to get the object of RequestDispatcher?
11
RequestDispatcher
Example of RequestDispatcher interface:
– In this example, we are validating the password entered
by the user.
12
RequestDispatcher
Example of RequestDispatcher interface:
• In this example, we have created following files:
– index.html file: for getting input from the user.
– Login.java file: a servlet class for processing the
response. If password is servet, it will forward the
request to the welcome servlet.
– WelcomeServlet.java file: a servlet class for displaying
the welcome message.
– web.xml file: a deployment descriptor file that contains
the information about the servlet.
13
RequestDispatcher
Example of RequestDispatcher interface:
• In this example, we have created following files:
– index.html file: for getting input from the user.
– Login.java file: a servlet class for processing the
response. If password is servet, it will forward the
request to the welcome servlet.
– WelcomeServlet.java file: a servlet class for displaying
the welcome message.
– web.xml file: a deployment descriptor file that contains
the information about the servlet.
14
RequestDispatcher
Example of RequestDispatcher interface:
15
RequestDispatcher
Example of RequestDispatcher interface:
16
RequestDispatcher
17
RequestDispatcher
18
RequestDispatcher
19
RequestDispatcher
20
RequestDispatcher
21
RequestDispatcher
22
RequestDispatcher
23
Question(s)?
24
Thank you
25