发布于 2015-08-17 14:46:15 | 128 次阅读 | 评论: 0 | 来源: 网络整理

<c:url>标记格式的URL转换为字符串,并将其存储到一个变量。重写必要时,此标签会自动执行URL。 var属性指定将包含格式化的URL中的变量。

JSTL的URL标记是写在调用response.encodeURL()方法只是一种替代方法。唯一的真正优势是URL标记提供的是正确的URL编码,包括子param标签中指定的参数。

属性:

<c:url>标记具有以下属性:

属性 描述 必须 默认
value 根URL Yes None
context / followed by the name of a local web application No Current application
var Name of the variable to expose the processed URL No Print to page
scope Scope of the variable to expose the processed URL No Page

例子:


<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title><c:url> Tag Example</title>
</head>
<body>
<a href="<c:url value="/jsp/index.html"/>">TEST</a>
</body>
</html>

这将产生以下输出结果:


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

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