<c:import>標(biāo)簽提供了所有<jsp:include>行為標(biāo)簽所具有的功能,同時(shí)也允許包含絕對(duì)URL。
舉例來(lái)說(shuō),使用<c:import>標(biāo)簽可以包含一個(gè)FTP服務(wù)器中不同的網(wǎng)頁(yè)內(nèi)容。
<c:import url="<string>" var="<string>" scope="<string>" varRender="<string>" context="<string>" charEncoding="<string>"/>
<c:import>標(biāo)簽有如下屬性:
屬性 | 描述 | 是否必要 | 默認(rèn)值 |
---|---|---|---|
url | 需要檢索和引入的頁(yè)面的URL | 是 | 無(wú) |
context | / 緊接著一個(gè)本地網(wǎng)絡(luò)應(yīng)用程序的名稱(chēng) | 否 | 當(dāng)前應(yīng)用程序 |
charEncoding | 所引入的數(shù)據(jù)的字符編碼集 | 否 | ISO-8859-1 |
var | 用于存儲(chǔ)所引入的文本的變量 | 否 | Print to page |
scope | var屬性的作用域 | 否 | Page |
varReader | 可選的用于提供java.io.Reader對(duì)象的變量 | 否 | 無(wú) |
%@ 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 標(biāo)簽實(shí)例</title> </head> <body> <c:import var="data" url="http://eska-fuses.cn"/> <c:out value="${data}"/> </body> </html>
以上程序?qū)?huì)打印http://eska-fuses.cn頁(yè)面,您可以自己動(dòng)手嘗試一下。
更多建議: