JSP

JSP Projects

JSP Project

What is include directive Tag?
Previous Home Next

 

If a programmer wants include the contents of one file to the other than include tag is used.

Jsp Include Directive:

The include directive is used to include the contents of any resource it may be jsp file, html file or text file. The include directive includes the original content of the included resource at page translation time (the jsp page is translated only once so it will be better to include static resource).

Advantage of Include directive

.Code Reusability

Syntax of include directive

<%@ include file="resourceName" %>

Example: include directive

In this example, we are including the content of the header.html file. To run this example you must create an header.html file.

<html>

<body>

<%@ include file="header.html" %>

Today is: <%= java.util.Calendar.getInstance().getTime() %>

</body>

</html>

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

 For example to add the dynamic file we write the include directive tag as
&lt;%@ include file="r4r.tagf" %&gt;
Two  types of file are included in this tag Static file or html file with .html extension and other is dynamic file with .tagf extension.


 

Previous Home Next