12.1. Including Files at Page Translation Time

You use the include directive to include a file in the main JSP document at the time the document is translated into a servlet (which is typically the first time it is accessed). The syntax is as follows:

<%@ include file="Relative URL" %>

There are two ramifications of the fact that the included file is inserted at page translation time, not at request time as with jsp:include (Section 12.2).

First, you include the actual file itself, unlike with jsp:include , where the server runs the page and inserts its output. This approach means that the included file can contain JSP constructs (such as field or method declarations) that affect the main page as a whole.

Second, if the included file changes, ...

Get Core Servlets and JavaServer Pages™ 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.