Name

<jsp:include>

Synopsis

The <jsp:include> action includes the response from another JSP page, servlet, or static file in the same web application. The execution of the current page continues after including the response generated by the target resource.

If any response content has been buffered when the <jsp:include> action is executed, the flush attribute controls whether or not to flush the buffer.

The URI path information, available through the implicit request object, reflects the URI path information for the source JSP page even in the target resource. All other request information is also left untouched, so the target resource has access to all the original parameters and headers passed with the request. Additional parameters can be passed to the target resource through <jsp:param> elements in the <jsp:include> element’s body.

Syntax

<jsp:include page="pageOrContextRelativePath" [flush="true|false"] />

Attributes

Attribute name

Java type

Dynamic value accepted

Description

page
String

RT expression

A page-relative or context-relative URI path for the resource to include.

flush
boolean

No

Set to true to flush the buffer before including the target. Default is false.

Example

<jsp:include page="navigation.jsp" />

Get JavaServer Pages, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.