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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is empty tag?

683


What are the components and containers in java?

681


What is commit?

816


What does web module contain?

694


Describe the ear, war, and jar.

683


Explain j2ee architecture.

775


What is japplet in java?

682


What is component-managed sign-on ?

684


What is j2ee stand for?

656


What is context attribute?

731


What is filter chain?

695


What are the components of awt in java?

681


What is java secure socket extension (jsse)?

739


What is basic authentication?

715


Why awt is used in java?

675