1. Introduction
The include directives in the JSP are in the form of:
<%@ include file= ""%>
Typically, include is considered when parts of all pages in an application, such as headers, footers, and navigation bars, are the same. The include directive element of the <%@ include file= ""%>,jsp reads the contents of the specified page. and combine the content with the original page. (This process is in the translation phase: that is, the JSP is translated into a servlet stage.) )
2, and jsp:include action instructions are different
There are two main differences between include and Jsp:include;
The first is the execution time:
<%@ include file= "Relativeuri"%> is performed during the translation phase
<jsp:include page= "Relativeuri" flush= "true"/> executes at the request processing stage.
The second is to introduce the different content:
The <%@ include file= "Relativeuri"%> introduces static text (html,jsp) and brings it together before the JSP page is converted to a servlet.
<jsp:include page= "Relativeuri" flush= "true"/> Introduces the response text generated by the execution page or servlet.
In addition, both the file and Page properties are interpreted as a relative URI in both usages. If it starts with a slash, it is an environment-related path. will be interpreted according to the prefix of the URI assigned to the application, if it is not preceded by a slash, then the page-related path. Explain the path to the page where the file was introduced.
Reference: Baidu Encyclopedia