What is the use of RequestDispatcher in servlet?

Answer Posted / naresh

consider there are two servlet,such as "aservlet"
and "bservlet"
suppose a client requests "aservlet" ,which
inturn "aservlet" depends on "bservlet"
we must redirect the request from "aservlet" to "bservlet

this is done by two steps :-
1.RequestDispatcher disp= getServletContext
().getRequestDispatcher("/url of bservlet");
2.
2.1.- rd.forward(req,res);
2.2.-rd.include(req,res);

Is This Answer Correct ?    7 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How httpservlet is different from the genericservlet?

569


What is the servlet?

625


How is a servlet implemented in code?

568


Describe in brief RequestDespatcher?

596


Explain the role of dispatcherservlet and contextloaderlistener.

610






What is the default http method in the servlet?

766


How do you communicate in between Applets and Servlets?

597


What is the inter-servlet communication?

704


What is servlet container?

668


Explain the difference between jsp and servlet?

592


What are the different ways we can maintain state between requests?

580


What is the capacity the doget can send to the server?

578


Write the code to get the server information in servlet.

575


What are the new features added to servlet 2.5?

596


A client sends requests to two different web components. Both of the components access the session. Will they end up using the same session object or different session ?

614