What is the difference between <%@ include ...> (directive include) and <jsp:include> ?
Question:
What is the difference between <%@ include ...> (directive include) and <jsp:include> ?
Question:What is the difference between <%@ include ...> (directive include) and <jsp:include> ?
Answer
The include directive :-
<%@ include file="fileName" %>
is static and processed at the time when the JSP page is translated into its equivalent servlet. The file included in the page at the time translation and compiled file also contain the included file code. This directive is normally used for including static resources only - like, banner, header, footer, etc. If you make some changes in the included file then it will not affect those files which had included this file.
The include action :-
<jsp:include page="relativeURL" />
is dynamic and processed at runtime. This will simply make a function call at run time to the included file. This action allows additional parameters to be passed via <jsp:param> child element of this include action element. If you make some changes in the included file then it will also affect those files which had included this file.
By:Jalees Date:
What is the difference between <%@ include ...> (directive include) and <jsp:include> ?