Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Jsp Simple-jsp-example How to include a File using directive and include action

Related Tutorials


 
 

Share on Google+Share on Google+

How to include a File using directive and include action

Advertisement
This directive has only one attribute named as file, which is used to include a file in the jsp page at the translation time.

How to include a File using directive and include action

        

<%@ include file = " "%>: - This is include directive. This directive has only one attribute named as file, which is used to include a file in the jsp page at the translation time. It is mainly used to include the static contents which doesn't need to be changed frequently. In jsp if we have to add a static content, whether it is a html, xml or any jsp page we should use include directive. The inclusion of the file is done at the translation time.

<jsp:include page = " ">:- This is known as the include standard action. This standard action is used to include a file at run time. This standard action is evaluated at the run time.

In this simple jsp program we have used both the include directive and the include standard action in the same jsp file.

The code of the program is given below:

 

<html>
	<head>
<title>
ssHow to include file at compile time and at run time</title>
	</head>
	<body>
		<h1>Directive Test Page</h1>
		<%@ include file = "include.html"%>
		<%@ include file ="Date.jsp"%>
		<h1>Using the include action</h1>
		<jsp:include page = "include.html"/>
		<jsp:include page ="Date.jsp"/>
	</body>
<html>

The output of the program is given below:

Download this example.

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  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.

Posted on: February 8, 2008

Related Tutorials

Discuss: How to include a File using directive and include action  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com