The "include" directive of JSP


 

The "include" directive of JSP

In this Section, we will discuss about "include" directive of JSP with an example.

In this Section, we will discuss about "include" directive of JSP with an example.

The "include" directive of JSP 

In this Section, we will discuss about "include" directive of JSP with an example.

The include directive :

? Specifies the names of the files to be inserted during the compilation of the JSP page and executes later.

? Creates the contents of the included files as part of the JSP page.

? Inserts a part of the code that is common to multiple pages.

? The syntax of the include directive is :

   <%@ include file = ?URLname? %>

The "URLname" is the relative URL of the file from the root directory of your JSP application.Contents of the include file is added to the calling JSP page if the resource is static otherwise the included file acts on the request object and result after execution of the included dynamic file on the server.

CODE :

<html>

<head><title>Include Directive JSP Page.</title></head>

<body>

<font color="blue">

<%@include file="hello.jsp"%>

<br/>

<font size="5"><%="Example of include JSP directive" %></font><br/>

</font>

</body>

</html>

 

OUTPUT :

DOWNLOAD SOURCE CODE

Ads