Google News
logo
JSP - Interview Questions
What is the difference between include directive and include action tag?
Both include directive and include action tag are used to add a file into existing jsp. The difference is in the way they include the file.
 
* Include directive includes the file during translation stage of life cycle whereas, the include action includes the file at runtime.

* If the included file is changed but not the JSP which is including it then the changes will not reflect if the include directive is used. Because jsp is not changed and that means it will not be translated for the request. For such a station an action tag has to be used.

Syntax difference : 
Include directive : <%@ include file=”file_name” %> and 
 
include action : <jsp:include page=”file_name” />.
 
We can use the action tag with or without parameters. The same can not be done in the include directive.
Advertisement