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:

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

To include it in a JSP file use include statement


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


Welcome to JSP Tutorial

Copyright © 2017 www.studentstutorial.com