发布于 2015-08-17 14:57:56 | 77 次阅读 | 评论: 0 | 来源: 网络整理

<c:import>标签提供所有的<include>动作的功能,但也允许包含的绝对URL。

例如,使用导入import标签允许列入的内容从不同的Web站点或FTP服务器。 

属性:

<c:import>标签具有以下属性:

属性 描述 必须 默认
url URL to retrieve and import into the page Yes None
context / followed by the name of a local web application No Current application
charEncoding Character set to use for imported data No ISO-8859-1
var Name of the variable to store imported text No Print to page
scope Scope of the variable used to store imported text No Page
varReader Name of an alternate variable to expose java.io.Reader No None

例子:


<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title><c:import> Tag Example</title>
</head>
<body>
<c:import var="data" url="http://www.yiibai.com"/>
<c:out value="${data}"/>
</body>
</html>

上面的例子可以获取完整的内容从yiibai.com/index.html 并将存储在变量数据是最终要打印出来。自己尝试一下。

最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务