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

 
 


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

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

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 Pages:

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.