Share on Google+Share on Google+

The "include" directive of JSP

Advertisement
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

Advertisements

Advertisement

Posted on: June 15, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.