How many ways are available to ger RequestDispatcher object?

Answer Posted / seshendra

There are three ways to get RequestDispatcher object in the
servlet.

1. calling the getRequestDispatcher(String path) method on
ServletRequest.

RequestDispatcher rd=request.getRequestDispatcher(String path);


2. By getRequRequestDispatcher(String path) method on
ServletContext.

RequestDispatcher rd=context.getRequestDispatcher(String path);

3.by calling getNamedDispatcher(servlet logical name)on
ServletContext object


RequestDispatcher rd=context.getNamedDispatcher(servlet
logical name)

Is This Answer Correct ?    15 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can you use a servlet to generate a plain text instead of html?

590


Explain servlet.

566


How to upload a file to the server using servlet?

531


What is the need of session tracking in web application?

583


What is a servlet?

608






When Servlet is unloaded?

625


Explain mvc pattern.

592


Explain the custom jsp tags and the beans.

615


What is the process for chaining servlet?

607


Explain in brief the directory structure of a web application?

566


When servlet object is created?

600


What are the objects involved when a servlet receives a call from client?

545


What is a servlet engine?

544


Explain how to improve Servlet Performance?

594


How do you run a servlet?

538