<jsp:include>
Use the <jsp:include> tag to insert a text file in the JSP. At runtime, the Tomcat servlet container inserts the contents of the specified file in the JSP and processes the tags that the file contains.
Tip:
If you use JSPs extensively, you might want to build a library of standard “code fragments” that you reference using <jsp:include> tags.
Syntax
For interpreted pages: | <jsp:include page="file" flush="true"/> |
For static pages: | <%@ include file="file"%> |
Arguments
Argument | Description |
file.extension | Text file to insert. If the text file is not in the same directory as the JSP that references it, specify the path to the file relative to the JSP. |
Examples
The following examples insert the TMPL_ShipToBlock.html file into the JSP.
To insert the TMPL_ShipToBlock.html file in the same directory as the JSP.
<webm:scope recordName="buyerInfo">
<p>Shipped To:<br>
<jsp:include page="TMPL_ShipToBlock.html" flush="true"/>
</p>
</webm:scope>
To insert the TMPL_ShipToBlock.html file in a subdirectory named "StandardJSPs" within the directory in which the JSP resides.
<webm:scope recordName="buyerInfo">
<p>Shipped To:<br>
<jsp:include page="StandardJSPs/TMPL_ShipToBlock.html" flush="true"/>
</p>
</webm:scope>
To insert the TMPL_ShipToBlock.html file in the parent directory of the JSP.
<webm:scope recordName="buyerInfo">
<p>Shipped To:<br>
<jsp:include page="../TMPL_ShipToBlock.html" flush="true"/>
</p>
</webm:scope>