JSP include standard action and include directive

S.No.
 include directive

<%@ include file="..." %>

 JSP include

<jsp:include page="..." ></jsp:include>..........

 1. Content of the file specified in the attribute “file” of the include directive will be pasted as it is at tranlation time , where include directive is used in the jsp  At runtime, the includED file will be executed and the response will be included in the includING jsp.

Both request and response objects are passed as parameters to the includED jsp

 2.  Scriptlet variables declared in the parent page can be accessed in the includED jsp file  The values of the scriptlets variables need to be passed explicitly to the includED page
 3.  Only one servlet (source jsp compiled into java file) is executed at run time  Each includED page is executed as separate servlet at run-time
 4. Since there is size limit of 64 KB on the jvm method , the code of includED jsp in inlined in the service method of includING jsp’s service method should not exceed the size limit otherwise the JSP compilation will likely to be failed  No such limitation since ,since separate compilation is taking place for each includED page.
 5. Changes to the includED files may not take effect until the parent page is updated  Changes will reflected since response form the includED pages will be included at runtime
 6.  The includED file does not need to able to be compiled as a standalone JSP  The included page must be able to be run on its own.
Rate this post

Leave a Reply