Latest Tutorials| Questions and Answers|Ask Questions?|Site Map




Have Programming Question? Ask it here!
 
 
 


Vijay Kumar
SendRedirect()
1 Answer(s)      3 years and 5 months ago
Posted in : Servlet Interview Questions


What is the difference between sendRedirect() and forward()?


Advertisement
View Answers

November 17, 2010 at 12:59 PM


Response.sendRedirect (): This function is used, when we want to redirect the client request to some other site (i.e out of our context) or when ever we want to redirect errors. If you are using sendRedirect (), then it will be visible to the client that means the URL which you have been redirected will be visible in the address bar. Redirect response to the client using the specified redirect location URL.

Forward() : This can be done in two ways by Request & ServeletContext. Forwarding a request from a servlet to another resource (servlet, JSP file, or HTML file) on the server. Forward is done at server side, without the client?s knowledge.



Related Tutorials/Questions & Answers:
 

 

 

DMCA.com