Include Directive in JSP

How is Include Directive used in JSP?

Explanation

Include directive is used to include a static or a dynamic file into a JSP page.

Syntax:


<% @ include file="filename" % >

Example :


<%@ page language="java" %>
<h4>File Included is below.</h4>
<%@ include file="display.jsp"%>

Code in display.jsp


<h5>File for Include Directive</h5>
Additon of 1 and 2 ::${1+2}
Result :

File is Included below.
File for Include Directive
Additon of 1 and 2 ::3

In the above example we have included a file "display.jsp" which is used to evaluvate an expression "{1+2}".

Ask Questions

Ask Question