<C: import> tag
Previous: <c: choose>, < c: when>, <c: otherwise> tag
Next: <c: forEach>, < c: forTokens> tag
<C: import> tag provides all the <jsp: include> tag behavior with the function, but also allows the inclusion of an absolute URL.
For example, use <c: import> tag can contain an FTP server in different web content.
Syntax
<c:import url="<string>" var="<string>" scope="<string>" varRender="<string>" context="<string>" charEncoding="<string>"/>
Attributes
<C: import> tag has the following attributes:
Attributes | description | If necessary | Defaults |
---|---|---|---|
url | URL resource to be imported, it can be relative and absolute paths, and can be imported into other host resources | Yes | no |
context | When using a relative path to access external resources, context, context specifies the name of the resource. | no | Current application |
charEncoding | Set the character encoding of the incoming data | no | ISO-8859-1 |
var | Introducing variable for storing the text | no | no |
scope | Scope var attribute | no | page |
varReader | Optional object variable is used to provide java.io.Reader | no | no |
Examples Demo
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <html> <head> <title>c:import 标签实例</title> </head> <body> <c:import var="data" url="http://www.w3big.com"/> <c:out value="${data}"/> </body> </html>
The above program will print http://www.w3big.com "page's source code, you can try it yourself.
Previous: <c: choose>, < c: when>, <c: otherwise> tag
Next: <c: forEach>, < c: forTokens> tag