.


Divya

JSP Include Directive


The JSP include directive is used to takes all the JSP file, HTML file or text file that exits on the specified file and copies into the file that include statement.

Include directive is very useful when we want to include the same JSP, HTML or text file on multiple pages of a web application.

<%@ Include file="filename"; %>

JSP Include Directive Example

Assume we have a standard footer file called "footer.html", that looks like this:

footer.html
<p>Copyright © 2017 www.studentstutorial.com</p>

To include it in a JSP file use include statement

Example

<!DOCTYPE html>
<html>
<head>
<title>JSP include</title>
</head>
<body>
<% out.print("Welcome to JSP Tutorial"); %>
<%@ Include file="footer.html"; %> </body>
</html>

Output

Welcome to JSP Tutorial

Copyright © 2017 www.studentstutorial.com



.