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
What is empty tag?
What are the components and containers in java?
What is commit?
What does web module contain?
Describe the ear, war, and jar.
Explain j2ee architecture.
What is japplet in java?
What is component-managed sign-on ?
What is j2ee stand for?
What is context attribute?
What is filter chain?
What are the components of awt in java?
What is java secure socket extension (jsse)?
What is basic authentication?
Why awt is used in java?