What are the include in JSP? What is the difference ?, Jspinclude
What are the include in JSP? What is the difference?
1. What are the include items in JSP?
(1) <% @ include file = "" %>
(2) <jsp: include page = "" flush = "true"/>
2. Differences
(1) The former is an indicator element, and the latter is a behavior element.
(2) The former is merged into a page, and the latter is merged into a file and then converted into a Servlet by the JSP Container
What is $ {} used in the jsp webpage? <jsp: What is different from <%, <jsp: include is different from <% include,
$ {...} It is an EL expression language that can simplify access to jsp built-in objects. It can easily implement conditional output without using JAVA programming, eliminating the need for most types of conversions. The simplest example <Body>
4 + 5 =$ {4 + 5} <br>
5*2 =$ {5*2}
</Body>
</Html>
The page displays 4 + 5 = 9
5*2 = 10
This is a simple example, but the problem is that simplified languages avoid many types of conversions.
<% Include> is a command element and static inclusion. The execution time is in the compilation phase, and the introduced content is a static file. It is integrated with the inclusion when compiled into servlet, therefore, the file of include cannot be a variable or be followed by any parameter after file.
<Jsp: include> is an action element and a dynamic inclusion. The execution time is in the request stage. The introduced content is dynamically generated when the execution page is requested and then included in the page.
What is the difference between the include command and the <jsp: include> action in jsp?
Simply put:
The include command is used to add the JAVA code (Source Code) of other pages, which is combined with the code of this page. It is equivalent to copying the source code from that page to this page, and then compiling. So variables can be shared. Because the source code of other files is already included in the compilation of this page, this page will be ignored when other pages are changed in the future, because it has already been compiled.
<Jsp: include> an action is to add the HTML result page after the code of the two pages is run to the HTML result page after the page is run. Therefore, variables cannot be shared.