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 |
How to call one constructor from the other constructor ?
Tell me how many ways are there to initialise an integer with a constant.
What do you understand by the term polymorphism?
What are the legal operands of the instanceof operator?
What are advantages of exception handling in java?
What are the drawbacks of reflection?
Differentiate between run time error and syntax error.
What are the restrictions imposed by a Security Manager on Applets?.
What is the final keyword?
What is a parameter in matrices?
Why java applets are more useful for intranets as compared to internet?
Write a program to print all permutations of string?