1、 What is static import ?
Static import refers to , Embed an external file into the current JSP In file , At the same time, analyze the JSP sentence , It will also include other compilation instructions for the target page .
include The static import instructions of use syntax :
<%@include file="relativeURLSpec"%>
Examples of static import usage include1.jsp:
<%@ page contentType="text/html; charset=utf-8" language="java" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> static state include Example </title>
</head>
<body>
<!-- Use include Compile the specified import page -->
<%@include file="error.jsp"%>
</body>
</html>
among error.jsp It's a simple error handling page , The code is as follows :
<%@ page contentType="text/html; charset=utf-8" language="java" isErrorPage="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> Error page </title>
</head>
<body>
This is an error handling page </br>
</body>
</html>
stay tomcat Run the static include After example , View the generated servlet Class can see the following code snippet
( View by :windows Next , find tomcat Install under directory work Folder , Get into Catalina Under folder localhost Folder , Find the folder where the current project is located , find org Catalog , Into the next apache In the catalog jsp Folder , You can see a include1_jsp.java file , That's what it's about include1.jsp Corresponding generated servlet class .ps: I put this test page on webDemo Under the , So my catalog is \apache-tomcat-7.0.47\work\Catalina\localhost\webDemo\org\apache\jsp)
You can see from the box that static import is : The included page will completely contain the code of the included page at compile time . It's important to point out that , Static import also includes the compilation instructions of the included page , If the compilation instructions of two pages conflict , Then the page will go wrong .
2、 What is dynamic import
Dynamic import doesn't import include The compilation instruction of the page is , It's just going to be imported into the page body Insert content into this page .
The syntax format of dynamic import :
<jsp:include page="{relativeURL|<%=expression%>}" flush="true"/>
perhaps
<jsp:include page="{relativeURL|<%=expression%>}" flush="true">
<jsp:param name="parameterName" value="parameterValue"/>
</jsp:include>
flush Property language specifies whether the output cache is transferred to the imported file . If specified as true, Is included in the imported file , If specified as false, It is included in the original file , about JSP1.1 The old version , Can only be set to false.
For the second grammatical format , Additional request parameters can be added to the imported page .
Dynamic import paradigm :
We will include1.jsp Code static import changed to dynamic import
<%@ page contentType="text/html; charset=utf-8" language="java" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> static state include Example </title>
</head>
<body>
<!-- Use include Compile the specified import page -->
<jsp:include page="error.jsp" />
</body>
</html>
After compiling, look at the generated servlet Code , You can see the following paragraph :
The code in the red box shows , Dynamic import just uses a include Method to insert the content of the target page , Instead of completely integrating the target page into this page .
Sum up , There are three differences between static import and dynamic import :
1、 Static import is to integrate the code of the imported page into , The two pages merge into a whole Servlet; And dynamic import is in Servlet Use in include Method to import the content of the imported page .
2、 During static import, the compilation instructions of the imported page will work ; When importing dynamically, the compiler instructions of the imported page will not work , Just insert the imported page body Content .
3、 Dynamic import can also add additional parameters . That is the following code way :
<jsp:include page="{relativeURL|<%=expression%>}" flush="true">
<jsp:param name="parameterName" value="parameterValue"/>
</jsp:include>
Jsp Of include The difference between static import and dynamic import of instructions
- jsp Inside include The difference between static import and dynamic import
Static import is to integrate the imported page into the imported page : And dynamic import is just servlet It's got... In it include Method , This is the page that was imported body What's in the label 1. What is static import ? Static import refers to , Put an outside ...
- JSP- Explain ( Generate java class 、 Static import and dynamic import )
One .JSP Technical introduction JSP yes Java Server Page Abbreviation , It is Servlet An extension of , Its role is to simplify the creation and maintenance of the website . JSP yes HTML Code and the Java A mixture of code . JSP Files are usually JSP or J ...
- One jsp The page introduces another jsp Three ways to create a page And the difference between static introduction and dynamic introduction
Reprinted , Reprinted from :http://blog.csdn.net/fn_2015/article/details/70311495 1. The first one is :jstl import <c:import url=& ...
- JSP The differences and relations between static and dynamic page inclusion
--- Resume content start --- JSP The differences and relations between static and dynamic page inclusion : 1.<%@ include file=" " %> It's an instruction element ,<jsp:include p ...
- JSP Of include Instructions
JSP Of include Instructions : The contents of a static file inserted into the current page . stay test5.jsp Inside <%@ include file="test5_1.jsp" %> newly build ...
- Cattle from Java What is the knowledge point JSP Of 3 Big common instructions 、JSP Of 6 Big moves 、JSP in include Instructions and include What's the difference between movements
Not much to say , Direct delivery of dry goods ! JSP Of 3 Big common instructions Contains instructions (Include directive): Used to include files and merge file contents to the current page . Page instructions (Page directive): Used to define JSP In the page ...
- The difference between static library and dynamic library and win The platform and linux Platform code implementation
The difference between static library and dynamic library What is a library The library is written , The existing , ripe , Reusable code . In reality, every program depends on a lot of underlying libraries , It's impossible for everyone's code to start from scratch , So the significance of the existence of the library is extraordinary . In essence , Library is a kind of library that can ...
- iOS Static library and dynamic library in , difference 、 Making and using
If we have some functions to use for others , But I don't want to make it public , For example, the map of Gaud . Third party login sharing and so on , And then we're going to pack it up as a library . There are two kinds of Libraries: static library and dynamic library : Static library : With .a and .framework For the file suffix . Dynamic library : ...
- iOS Static library and dynamic library in , difference 、 Making and using
If we have some functions to use for others , But I don't want to make it public , For example, the map of Gaud . Third party login sharing and so on , And then we're going to pack it up as a library . There are two kinds of Libraries: static library and dynamic library : Static library : With .a and .framework For the file suffix . Dynamic library : ...
Random recommendation
- Cannot create a server using the selected type.
1. sign out eclipse 2. To [ Project directory ]/.metadata/.plugins/org.eclipse.core.runtime 3. hold org.eclipse.wst.server.core.p ...
- Give Way HTML5 Semantic tags are compatible IE browser
Solution :IE9 The following older browsers do not support new semantic tags . One of the solutions is to use js take HTML5 Added tags are created , It looks like this .( Put it in header Position ) <script> var html5 ...
- Dump the specified data block and view TRC Information
1. Dumps the specified block : Two messages are needed : File number and block number [email protected]>alter system dump datafile 1 block 100; System altered. 2. Locate and find out use ...
- About Java Control of null pointer ( turn )
1) In the past String( character string ) call equal() and equalsingnoreCase() Not unknown objects It's usually called in a non empty string that already exists equals(). because equal() The method is symmetric , call a. ...
- WPF Blindfolded pop ups
Because interface design needs , To add a mask effect to the pop-up window , In Baidu and google Searched for half a day , There is no satisfactory solution , In the end, I had to think of a way to achieve a , The principle is relatively simple , Now share with you . Let's take a look at the effect .. The principle is ...
- python Regular expression notes
----------re Module for regular use ---------- #result=re.match( Regular expressions , String to match ): Use regularization to filter strings, match from the front #result.group(): take ...
- mybatis_helloworld(2)_ Source code
An excerpt from :http://blog.csdn.net/y172158950/article/details/16982123 stay helloworld(1) in , Analysis of the insert A data flow , Now analyze the source ...
- Spark DataFrame Of groupBy vs groupByKey
In the use of Spark SQL In the process of , Often used groupBy This function does some statistical work . But you'll find that besides groupBy Outside , One more groupByKey( Be careful RDD There is also a groupByKey, And here it is gro ...
- addiction Link-Cut tree I can't extricate myself from it :[BZOJ2049] Cave exploration ( Konjac LCT The board )
From Konjac \(Hero \_of \_Someone\) Of \(LCT\) Learning notes I've learned a lot recently \(LCT\) , So I brush angrily \(LCT\) Collection ...... $ $ Learning from Clove ...
- java Concurrent programming : Thread safety management class -- Atomic operation class --AtomicLong
It can be updated atomically long value . A description of the properties of atomic variables , see also java.util.concurrent.atomic Package specification .AtomicLong Available in applications ( For example, the serial number added in atomic way ), ...