JSP Include directive

Include directive is a type of directive tag. If a programmer wants to include contents of a file inside another, then the Include directive is used. The file included can be either static ( HTML file) or dynamic (i.e., another tag file). The include directive is used to include the contents of other file in the current tag file.

Syntax of Include directive is:

<%@ include file = “xxx.html/xx.tagf”%>

In the above statement, include and file are keywords. This includes either .html (static file) or .tagf file (dynamic file) between ” ” in the include directive.

For instance:

<%@ include file = “include/exforsys.html”%>

Above example shows how to include a static resource called exforsys.html in an include directive. The above example includes the html from exforsys.html found in the include directory into the current JPS page.

For example:

The user includes a dynamic file in the include directive:

<%@ include file=”exforsys.tagf” %>

The above example shows how to include a dynamic resource called exforsys.tagf in the include directive.

Leave a Reply

Your email address will not be published. Required fields are marked *