Includes static and dynamic resources in the current page. Processing resumes in the calling JSP once the inclusion is completed.
If the including page's output is buffered, then the buffer is flushed prior to the inclusion. This flush prevents the included page from being able to set response headers. Therefore, the included page cannot use methods such as setCookie
.
The following example includes an HTML page:
<jsp:include page="/templates/copyright.html"/>
The syntax for jsp:include is shown below:
<jsp:include page="path" flush="true"/>
or:
<jsp:include page="path" flush="true"> <jsp:param name="paramName" value="paramValue" /> ... </jsp:include>
Specifies the path of the included file. If path begins with "/" then the path is relative to the JSP page's application. If the path omits a leading "/", the path is considered relative to the path of the JSP page being translated.
For more information on the path, see Specifying a relative URL within a JSP.
If you set this attribute to "true,"
the buffer is flushed. A "false"
value is not valid in JSP 1.1.
The default value is "true".
The second form of the jsp:include shows the addition of the jsp:param action. This action enables you to add parameters to the HTTP request received by the destination JSP page. For more information, see jsp:param.