what is the main use of the RequestDispatch object, how we
this in realtime project
Answers were Sorted based on User's Feedback
Answer / sagar
RequestDispatch is mainly used to shipping request
attributes from one servlet/jsp to another servlet/jsp.
While doing this we first create RequestDispatch instance
with string url as parameter to where request data to be
shipped. Then we cal reqDispatchReference.forward
(request,response) method. This is something like assigning
work to third party.
Ex:(to forward request data from Servlet1 to page2.jsp)
class Servlet1 extends HttpServlet{
public void service(... request,... response){
...........
RequestDispatcher rd=request.RequestDispatcher("page2.jsp");
try
{
rd.forward(request,response);
}
catch(Exception e)
{
}
}
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / gangadhar m
hi,
The main use of RequestDispatcher is when u want to transfer
control from one webapplication to another webapplication
deployed in same server(its web/ app server).
If you want to transfer control from one webapplication to
another webapplication those are deployed in different
servers( Ex one in Tomcat, another in Weblogic) use
response.sendRedirect("url"); method.
if u want any confirmation please call me.
my mobile no is 09096272808
| Is This Answer Correct ? | 4 Yes | 4 No |
Answer / chandra sekar
The main use of Request Dispatcher Objest is to share
request object between two servlets
| Is This Answer Correct ? | 0 Yes | 1 No |
What is the use of method saveorupdate()?
What is a gui in java?
to update a batch in a table in jdbc which method of statement object is used.
where exactly the servlets and jsp's are stored?
what is the purpose and activity of SessionFactory in hibernate?
13 Answers Cognizant, HCL, Oracle, PiServe Technologies,
Urgent recruitment in CTS for JAVA .Experience 3 to 10 years.
What is java 2 platform, micro edition (j2me)?
What is a web container in j2ee?
what is the main use of the RequestDispatch object, how we this in realtime project
What is j2ee product provider?
What are the different types of events in java?
Define connection pooling?