The RequestDispatcher gives servlets the capabilities of SSI includes.
The forwarded or included page is handled as a normal page request.
RequestDispatcher disp;
disp = request.getRequestDispatcher("inc.jsp?a=b");
disp.include(request, response);
Servlets typically use ServletRequest.setAttribute()
to communicate between included pages.
A popular architecture uses servlets to process the initial request
and JSP files to format the results. That template architecture uses
request attributes to communicate data from the servlet to the JSP page.
disp.forward() transfers the request to the JSP file.
|