RequestDispatcher object, difference between include( ) and forward( ) method.

RequestDispatcher object, difference between include( ) and forward( ) method.

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 Tutorials/Questions & Answers:

Ads