JSP Include Directive

JSP Include Directive

It is used to include some other pages into the JSP document, It may be JSP file, html file or text file. This is known as static include because the target page is located and included at the time of page compilation.

The jsp page is translated only once so it will be better to include static resource.

Advantage of Include directive

Code Re-usability

Syntax of Include directive elements

Syntax

<%@ include file="resourceName"%>

Example

<html>
<body>
<%@ include file="footer.html" %>
</body>
</html>

Note: The include directive includes the original content, so the actual page size grows at run-time.