• Post Reply Bookmark Topic Watch Topic
  • New Topic

getRequestDispatcher route's difference,

 
edi kapllani
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone please help me to understand differences between:
getConfig().getServletContext().getRequestDispatcher("pathToServlet");
and request.getRequestDispatcher("pathToServlet");
..................
and differences between forward(request,response)and sendRedirect(url);
thanks in advance!
edi
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When u want to forward the request to some other servlet,JSP ot HTML use forward method. This executes at the server side.
The sendRedirect involves a round trip to the client.
When u want to forward the request to other server u can use this .. sendRidect involves a entriely a new request to the client..It is possible to use sendredirect to redirect request to servlets,jsp or HTML pages within the same server but it not efficient becoz it involves a round trip to the client..
[ April 26, 2002: Message edited by: pradeep bhat ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!