- Posted by: Dipes Biswas
- Posted on: November 22 2000 08:22 EST
can anybody tell me the difference of requestDispatcher.forward() and requestDispatcher.include()?
and where to use which one ?
thanks in advance.
- difference between forward() and include of requestDispatcher ? by Kapil Israni on November 22 2000 10:19 EST
will difference is in their name itself.
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.
hope this helps
Yes, this is all I wanted.
but does this mean that forward () does not send control back to this current servlet(where we hav executed our forward call) after procesing jsp/class. ??
but does this mean that forward ()
does not send control back to this current servlet(where we hav executed our forward call) after procesing jsp/class. ??
Dude, that is not possible, it's java after all. Control will comeback but it just means that you cannot modify the stream.