what is the main use of the RequestDispatch object, how we
this in realtime project

Answers were Sorted based on User's Feedback



what is the main use of the RequestDispatch object, how we this in realtime project..

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

what is the main use of the RequestDispatch object, how we this in realtime project..

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

what is the main use of the RequestDispatch object, how we this in realtime project..

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

Post New Answer

More J2EE Interview Questions

What are the main components of the j2ee application?

0 Answers  


static variable is a class variable which value remains constant for the entire class?? variable means value is changed....hear value is not changed... why it is called static variable

5 Answers   Infosys,


What is java mobile?

0 Answers  


What is callback methods Component methods called by the container to notify the component of important events in its life cycle?

0 Answers  


Which framework is best for java?

0 Answers  


What is instance in java?

0 Answers  


What does resource adapt module contain?

0 Answers  


Is java 100 percent pure object oriented?

0 Answers  


What is java full stack developer?

0 Answers  


Is eclipse written in java?

0 Answers  


What is callback methods?

0 Answers  


Difference between treemap & sortedset

3 Answers   Oracle,


Categories