"Turn": http://www.cnblogs.com/lazycoding/archive/2011/04/04/two_include.html
<%@ include file= "Relativeuri"%>
Let's start by explaining what both of these are:
<%@ include file= "Relativeuri"%> can be called static include ( static include ), is one of the JSP directives , ( JSP directives control how the JSP compiler generates a servlet (a servlet is a server-side program written in Java.) Its main function is to interactively browse and modify data to generate dynamic Web content. The narrow-sense servlet refers to the Java language implementation of an interface, the generalized servlet refers to any implementation of the Servlet interface category, in general, people will understand the servlet as the latter. -Wikipedia)
called dynamic include ( dynamic inclusion ), is one of the JSP actions , ( A JSP action is a series of XML tags that can invoke functionality built into a network server.
Difference:
Execution Time:
<%@ include file= "relativeuri"%> is executed during the translation phase
is executed during the request processing phase.
The introduction of different content:
<%@ include file= "Relativeuri"%> introduces static text that is incorporated into a JSP page before it is transformed into a servlet. include, post-compile , do not check the changes contained in the file, for the inclusion of static pages, can be understood as purely to write code outside of a shared method, all variables are can and include its main file
shared, The two are highly tightly coupled and cannot have conflicting names of variables. The page setup can also be borrowed from the master file.
introduces the answer text generated by the execution page or servlet. The included files are compiled first, then included , and then displayed
Attention:
<%@ include file= ""%> directives are usually placed at the top of the code when they are written, and the main addition is the code that is reused, where the addition refers to attaching the source code intact. For example, when using this command in a JSP program, the value in file (that is, the files to be imported) cannot have extra tags or duplicates with the current JSP file. For example, do not include
And the application <jsp:include page= "" flush= ""/> Label import a reuse file, this file is compiled, popular point is to attach this to import the file after compiling the effect, so can contain with the current JSP program duplicate content, Because it will be parsed out before attaching it.
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. Check for changes in the included files, suitable for inclusion in dynamic pages, and can take parameters. It always checks for changes in the included files, is suitable for containing dynamic pages, and can take parameters.