What is the difference between the include() and forward() methods?
Answered
What is the difference between the include() and forward() methods?
Best answer
The RequestDispatcher include() method inserts the contents of the specified resource directly in the flow of the servlet response, as if it were part of the calling servlet. The include() method is often used to include common “boilerplate” text or template markup that may be included by many servlets.
The RequestDispatcher forward() method is used to show a different resource in place of the servlet that was originally called. The forward() method is often used where a servlet is taking a controller role; processing some input and deciding the outcome by returning a particular response page.