What is the use of RequestDispatcher in servlet?

Answer Posted / sekharbabu

RequestDispatcher is used to move/call the another
resources (Servlets,jsps,htmls) available in the web
applicaions
we can get RequestDispatcher in two ways
1. servletContext.getRequestDispatcher("/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 ?    25 Yes 17 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the life cycle of a servlet?

791


Why don't we write a constructor in a servlet?

594


What is the difference between 2 types of servlets?

650


Explain the difference between servlet and cgi?

611


Which application server is best for java?

560






What is Servlets and explain the advantages of Servlet life cycle?

585


What are the drawbacks of cgi?

572


What is http servlet?

584


Explain request dispatcher and its methods.

588


What is servlet container?

667


Given the request path below, which are context path, servlet path and path info?

549


What are all the advantages of servlet over cgi?

608


Who is responsible to create the object of servlet?

722


Why filter is used in servlet?

528


What is the difference between CGI and Servlet?

590