Three methods for introducing one jsp page and three methods for introducing static and dynamic jsp pages
1. First: jstl import
<C: import url = "inlayingJsp. jsp"> </c: import>
2. Type 2: jsp include command
The include command tells the container to copy all the content summarized by the included file and paste it into the file.
<% @ Include file = "inlayingJsp. jsp" %>
3. Third: jsp include action
<Jsp: include page = "inlayingJsp. jsp" flush = "true"/>
Note: (1) the include command inserts the source code of "Header. jsp" during conversion, while the <jsp: include> action inserts the response of "Header. jsp" at runtime.
<% @ Include is static. <% @ include, regardless of the txt text or jsp file, the contained pages are not re-compiled.
<% @ Include is a static inclusion. When several JSP files are translated into servlet, several class files are generated, if the variable I is defined in jsp1 and the variable I is also defined in jsp2, compilation will fail,
The jsp Container will tell you that I has already defined it.
<Jsp: include is dynamic inclusion. <jsp: include includes jsp files. This means that the included pages must be re-compiled every time the home page is loaded.
That is to say, no matter how many jsp pages you contain are translated into servlet, there is a class file.
Therefore, use the <% @ include option with caution!
(2) when using the jstl label, be sure to add the following code in the jsp file header: <% @ taglib prefix = "c" uri = "https://Java.sun.com/jsp/jstl/core" %>