JSTL--->core core tag library->url operations
-->import, param, URL, redirect
<c:import> include static or dynamic files to the JSP page itself
The biggest difference between him and <jsp:include> is that <jsp:include> can only contain files that are the same as their own web application, and <c:import> not just ... You can also include files from different Web application or other Web sites
Syntax 1:
<c:import url= "url" [context= "context"] [var= "VarName"] [scope= "{page|request|session|application}"] [ charencoding= "Charencoding"]>
Ontology content ...
</c:import>
Syntax 2:
<c:import url= "url" [context= "context"] varreader= "Varreadername" [charencoding= "charencoding"]>
Ontology content ...
</c:import>
Property:
URL: The address that the file is contained in
Context: Under the same container, other web platforms must start with/
var: Store the contents of a package file
JSP range C for Scope:var variables
Harencodeing: Encoded format of the included file V
Arreader: Storing the contents of a package file
Give several chestnuts:
1:<c:import url= "http://java.sun.com"/>
<c:import> will add http://java.sun.com content to the Web page
or <c:import url= "Ftp://ftp.cse.yzu.edu.tw/data.txt"/>
2:<c:import url= "hello.jsp"/> hello.jsp with the current page under the same WebApps folder,
If Add/, then jump to the project root directory WebApps below, it is necessary to write <c:import url= "Images/hello.txt"/>
3: If there are different items on the unified server, the included files must be defined in Server.xml, and the Crosscontext property value of <Context> must be true, so that files under others can be called by other Web sites
Called <context path= "/others" docbase= "others" debug= "0" reloadable= "true" crosscontext= "true"/>
<c:import url= "/jsp/index.html" context= "/others"/>
In addition to the,<c:import> also provides the Var and scope properties, its storage will not be output on the page, we can take out when needed
<c:import url= "/images/hello.txt" var= "S" scope= "session"/>
<c:import url= "http://java.sun.com" >
<c:param name= "test" value= "1234"/> </c:import>
It means to include a file that specifies the URL: http://java.sun.com?test=1234
<c:url> used to generate a URL
Syntax 1: No ontology content
<c:url value= "Value" [context= "context"] [var= "VarName"] [scope= "{page|request|session|application}"]/>
Syntax 2: Ontology content
<c:url value= "Value" [context= "context"] [var= "VarName"][scope= "{page|request|session|application}"] > <c: param> Marker </c:url>
Property: Value: The URL to execute
Context: Under the same container, other web platforms must start with/
var: the JSP scope that stores the contents of the contained file Scope:var variable
Chestnuts:
<c:url value= "/http www.javaworld.com.tw" >
<c:param name= "param" value= "value"/> </c:url>
Generated URL: http://www.javaworld.com.tw?param=value
<c:redirect> directs client requests from a JSP file to other files
Syntax 1: No ontology content
<c:redirect url= "url" [context= "context"]/>
Syntax 2: Ontology content
<c:redirect url= "url" [context= "context"] > <c:param> </c:redirect >
Example: <c:redirect url= "http://www.javaworld.com.tw"/> Web page will automatically guide http://www.javaworld.com.tw
Page <c:redirect url= "/jsp/index.html" context= "/others" to other platforms/>
JSTL--->core core tag library->url operations