static vs dynamic include

  • Static include: <%@ include %>, During the translation or compilation phase all the included JSP pages are compiled into a single Servlet.
  • Dynamic 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. Has run time performance overhead.
  • Use “static includes” when a JSP page does not change very often. For the pages, which change frequently, use dynamic includes.
  • The “dynamic include” (jsp:include) has a flush attribute. This attribute indicates whether the buffer should be flushed before including the new content.