Home


JSP forward

The jsp:forward request is similar to a jsp:include, but you cannot get control back afterwards. The attribute flush="true" is required because once you execute the include, you have committed your output. Prior to the include, the output might all be in a buffer; therefore, you can no longer do anything that might generate headers, including setContentType(), sendRedirect( ), and so on.

An alternate include mechanism is <%@include file="filename"%>. This mechanism is slightly more efficient (the inclusion is done at the time the JSP is being compiled), but is limited to including text files (the file is read, rather than being processed as an HTTP URL. The <jsp:include> can include a URL of any type (HTML, servlet, JSP, CGI, even PHP or ASP).

+

Search Tips   |   Advanced Search