The include directive

The include directive inserts text into a JSP file at translation time, effectively replacing the include directive. The result of this directive is a single JSP page containing both the contents of the including JSP page and the contents of the included JSP page.

The syntax for this directive is shown below:

<%@ include file = "path" %> 

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.

The include directive is useful when you have common functionality shared among several JSP pages. For an example of the include directive, see Performing parse-time include.