We all know that there are two types of include in JSP, namely
<%@ include file= ""%>
<jsp:include page= "" flush= "true"/>
The former is the instruction element, the latter is the behavior element. Where exactly are they going to be used? How to use and what is the difference between them? This should be a problem that many people see it all come to mind
One: The execution time:
<%@ include file= "relativeuri"%> is executed during the translation phase
<jsp:include page= "Relativeuri" flush= "true"/> is executed during the request processing phase.
Two: The introduction of different content:
<%@ include file= "Relativeuri"%>
Introduces static text (html,jsp), which is incorporated into a JSP page before it is transformed into a servlet.
<jsp:include page= "Relativeuri" flush= "true"/> Introduces the answer text generated by the execution page or servlet.
In addition, the file and page properties are interpreted as a relative URI in both usages. If it starts with a slash, it is an environment-dependent path. It is interpreted according to the prefix of the URI assigned to the application, if it does not start with a slash, then it is the page-dependent path. This is explained by the path to the page where the file was introduced.
The difference between include and jsp:include