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 |
What is the use of join method?
What is the difference between interpreter and compiling ?
What is an escape character in java?
What does replaceall do in java?
Explain about oops concepts.
0 Answers Aditi Placement Service,
What is difference between == equals () and compareto () method?
what is prepare statement? what is calabedtarement?
we know that every java prog must follows OOPS Principles. Anybody can answer, HOW THE FOLLOWING PROGRAM FOLLOWS OOPS CONCEPTS i.e, Inheritance,Polymarphism,Encapsulation? class a{ public static void main(String args[]){ System.out.println("Hello World"); } }
What are the two types of exceptions in java? Which are the differences between them?
What is the default value of an object reference declared as an instance variable?
What will be the default values of all the elements of an array defined as an instance variable?
What does escaping a character mean?