Home » Interview Questions » JSP Interview Questions » What are the differences between static and a dynamic include?
 

What are the differences between static and a dynamic include?

Static include <%@ include %> :
During the translation or compilation phase all the included JSP pages are compiled into a single Servlet.

Dynamic include <jsp:include …..>:
The dynamically included JSP is compiled into a separate Servlet. It is a separate resource, which gets to process the request, and the content generated by this resource is included in the JSP response.

Use “static includes” when a JSP page does not change very often. For the pages, which change frequently, use dynamic includes. JVM has a 64kb limit on the size of the method and the entire JSP page is rendered as a single method. If a JSP page is greater than 64kb, this probably indicates poor implementation. When this method reaches its limit of 64kb it throws an error. This error can be overcome by splitting the JSP files and including them dynamically (i.e. using <jsp:include…….>) because the dynamic includes generate separate JSP Servlet for each included file.

 

 



Write a comment

  • Required fields are marked with *.

If you have trouble reading the code, click on the code itself to generate a new random code.
Security Code: