What is the use of RequestDispatcher in servlet?

Answer Posted / bhudeep

RequestDispatcher is used to dispatch the request.that means
one resource take the ownership from another
resources (Servlets,jsps,htmls) available in the web
applicaions for handle the request.
we can get RequestDispatcher in two ways
1. servletContext.getRequestDispatcher("/absolute path");
2. servletRequet.getRequestDispatcher("relativepath");

now we can move to another resources with the following
methods available in RequestDispatcher
include(req,res);
forward(req,res);

Is This Answer Correct ?    21 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Difference between java beans & servlets?

588


What are all the protocols supported by httpservlet?

650


What do you mean by servlet context?

603


I have a requirement Here we have a ResultSet object that will contain 50 records i need to print those recors in to a webpage(i.e; view according to MVC architectures that mybe servlet or jsp) . Here i need to print the records 10 per page that is 1 to 10 in page one and 11 to 20 in page two like remaining will be appeared in other pages we need to display those page numbers whenever we click on that page number we will go to that page and display 10 records like we will display 5 pages it is like this << 1 2 3 4 5 next >>

2532


What is the servlet?

620






What's the use of servletcontext?

681


What are the types of servlets? Explain

674


What if you need to span your transaction across multiple servlet invocations?

581


What are sessions in servlets?

576


How do we translate jsp?

576


How to get the current httpsession object?

653


Why servlet is mostly used?

745


What is Client-Server Computing?

1897


What is load-on-startup in servlet?

586


What exactly is a servlet?

545