Explain the methods of request dispatcher in servlet?



Explain the methods of request dispatcher in servlet?..

Answer / Aneeta Yadav

The RequestDispatcher interface is used for forwarding and including requests within a servlet container. Here are some key methods:n
1. `forward(Request request, Response response)`: This method is used to forward the request to another resource (like another servlet or JSP page). The control doesn't return to the calling servlet.n
2. `include(Request request, Response response)`: This method is similar to forward but the difference is that it allows the calling servlet to continue execution after the included resource has been processed.n
3. `forwardParameters(Request request, Map<String, String[]> attributeMap)` and `include(Request request, Map<String, String[]> attributeMap)`: These methods are used to forward or include requests along with attributes (parameters).

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Servlets Interview Questions

In which cases Destroy() is invoked?

2 Answers  


How to get ip address in jsp login page and how to validate like 127.1.0.1 all should not be greater than 255

1 Answers   Bosch, EF,


Explain servlet.

1 Answers  


What are the servlet events?

1 Answers  


Which method is called when reference variable is passed in system.net?

1 Answers   HCL,


What's the architecture of a servlet package?

1 Answers  


Difference between get and post in java servlets?

1 Answers  


What is the capacity that doGet method can send to the server?

5 Answers  


What are the differences between servlet context vs servlet config?

1 Answers  


what is the difference between ServletContext and ServletConfig

7 Answers  


How do we share data using 'getservletcontext ()?

1 Answers  


Can we define constructor in Servlet class?

10 Answers   Accenture, Yugma,


Categories