Difference between JSP include directive and JSP include action?
include directive and include action tag both are used for including a file to the current JSP page. However there is a difference in the way they include file.
– include Directive: Static include – compile time include,no mechanism to notify change in included file.
JSP Include Directive
index.jsp
<html>
<head>
<title>JSP include Directive example</title>
</head>
<body>
<%@ include file="display.jsp" %>
</body>
</html>
disp.jsp
<p>Hello, Welcome to jsp page.</p>
Output: Hello, Welcome to jsp page.
– include Action : Dynamic Include – request time include, in case of any change in included file, server recompiles the included file.
JSP Include Action tag
index.jsp
<html>
<head>
<title>JSP include Action example</title>
</head>
<body>
<jsp:include page="disp.jsp" />
</body>
</html>
disp.jsp
<p>Hello, Welcome to jsp page.</p>
Output: Hello, Welcome to jsp page.
Recent Comments