Example

We are assuming you have result.jsp as your parent JSP file where you are displaying some university results. Now you are having this page categorised into header, content and footer.
So in your site header and footer remains same and only content part changes. Good way to make header.jsp and footer.jsp file separate and include them in your main content page.

So we also have header.jsp and footer.jsp. Let's focus on including hrader.jsp file into content.jsp file. There are two ways to do it and both ways are described below. 

JSP Static Include

In static type of include we use JSP Directives to do it. It includes your header.jsp page at translation time of result.jsp (main) page. So result.jsp source will be compiled and header.jsp will be included.

We define static jsp include like this

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

Now assume that you have changed logo into header.jsp file. In next request to result.jsp file if result servlet already exist them it will not compile again. So old header.jsp code will run.
This is drawback of using static jsp include in J2EE programming.

JSP Dynamic Include

Here we are talking about include action. We use include action like this

<jsp:include page="header.jsp" %>

here by using include action, at run time header.jsp file will be executed and result of header.jsp will be included in main page i.e. result.jsp.

In this case if you have made some changes to your header.jsp file, your changes will be visible in next request. this will happen as header.jsp is being executed at run time for each request.

This is difference between jsp static include and jsp dynamic include in J2EE programming. So if your file is static and rarely changes then you can use static include (JSP include Directive) . 
And on the other side if your file changes often then it will be better to use jsp dynamic include (JSP include Action).

Like, Comment and post your queries.