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 is button in java?

0 Answers  


What is difference between j2ee and java?

0 Answers  


Describe the ear, war, and jar.

0 Answers  


What is the name of java compiler?

0 Answers  


Hello frds .recently I've got a call for the test in infosys .iam having 1.5 yr exp in java pltfrm.plz can anyone tell the main process( in detail) for infosys experienced professionals

1 Answers  


Can I run seam in a j2ee environment?

0 Answers  


What is jlayeredpane java?

0 Answers  


what is direct link to download swing ebook,applet,ejb,core java

0 Answers  


Why awt is used in java?

0 Answers  


What is context attribute?

0 Answers  


What is declarative security ?

0 Answers  


i developed a Stateless Session bean program.And created a client by a common java class as class m {p s v m(String s[]){....}} And i called the bean deployed in weblogic.from cmd prompt And that run. mind it i have to set setenv,seting classpath for that bean jar file before compile and run it. ok when i do a servlet programme deployed in tomcat and call that bean then it give classdefnotfoundException and NoInitialContext like this.So how i sucessfully do this? Ok when i call that bean from java class from the console like i previously told, if i don't set setenv i found the same error on the cmd prompt. pls help to get out of it

2 Answers  


Categories