what is request dispatcher and how does it work?

Answers were Sorted based on User's Feedback



what is request dispatcher and how does it work?..

Answer / mahesh bolla

Request dispatcher is used to transfer the same rquest to
another page/servlet without user interaction.
Exampe:
Suppose we have 2 servlets.
Write the below code in first Servlet

----
----
RequestDispatchet rd = request.getRequestDispatcher
("/secondServlet");
rd.forward(request, response);
//or rd.include(request, response);

---
----
Similar thing can be done in JSPs also

Write the below code in one.jsp

<js:forward page="two.jsp"/>
or
<jsp:include page="two.jsp");

If we use "forwad" then request will transfered to the
second page but not returned back to first page. We can see
only the second page's output.

If we use "include" then the sencond page itself will be
included in the first page. Then the output is the
combination of both the pages.

Is This Answer Correct ?    34 Yes 2 No

what is request dispatcher and how does it work?..

Answer / sonal

yes its totaly right ...

Is This Answer Correct ?    9 Yes 1 No

Post New Answer

More Core Java Interview Questions

What is the meaning of I ++ in java?

0 Answers  


What is static variable with example?

0 Answers  


What are the advantages of compiled language?

0 Answers  


What is meant by class loader and how many types are there?

2 Answers   Apple,


What is assembly condition codes?

0 Answers  






Is char * a string?

0 Answers  


What is the difference between the jdk 1.02 event model and the event-delegation model introduced with jdk 1.1?

0 Answers  


Which is faster string or stringbuilder?

0 Answers  


Is a char always 1 byte?

0 Answers  


What is super?

0 Answers  


Explain the difference between abstract classes and interfaces in java?

0 Answers  


How many types of exception can occur in a java program?

0 Answers  


Categories