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



Home Answers Viewqa JSP-Servlet RequestDispatcher object, difference between include( ) and forward( ) method.
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


EldaSummer
RequestDispatcher object, difference between include( ) and forward( ) method.
1 Answer(s)      2 years and 2 months ago
Posted in : JSP-Servlet


The RequestDispatcher object has two methods, include( ) and forward( ). What is the difference?


Advertisement
View Answers

November 1, 2012 at 5:50 PM


Difference between include and forward:

forward is used to forward a request, that is control is transfered to the new servler/jsp. u shud take care to not put any our.println() statements in the servlet from where u plan to call forward method. in fact u cant even fire response.getWriter() method in this case. u can only do that in the servlet to which the control is bein fwded

include - means that the new servlet/jsp will be procesed and any out.println()/html stuff will be included and then control will come back to the servlet/jsp that called include method.



Related Tutorials/Questions & Answers:
Advertisements
 

 

 

DMCA.com