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

Explain the difference between a web server and a web container?

523


What is the difference between Difference between doGet() and doPost()?

761


How do you configure a centralized error handler in servlets?

542


What are session variable in servlets?

578


What exactly are the functions of servlet?

607






Explain the steps involved in placing a servlet within a package?

576


Can we override servlet service method?

591


What do you mean by annotations in servlet?

591


Describe in brief RequestDespatcher?

600


What's the difference between authentication and authorization?

556


Whether we can get deadlock situation in servlets?

580


What are the differences between the servletconfig interface and the servletcontext interface?

589


What are the features added in Servlet 2.5?

778


How to read request headers from servlets?

570


What are its drawbacks of cgi?

576