what is request dispatcher and how does it work?
Answers were Sorted based on User's Feedback
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 |
Can a static class implement an interface?
What is argument in java?
List the interfaces which extends collection interface?
Garbage collection in java?
what is jdk1.5 features?
Can an object be garbage collected while it is still reachable?
What is boolean law?
we have a 100 classes at that time which class we have to write main method? pls help me
What code optimizations techniques you follow in general practice?
2 Answers Accenture, TCS, Wipro,
What is lambda expression in java?
What is the difference between abstract class and interface1? What is an interface?
How to do validation of the fields in any project ?