发布于 2015-08-17 14:59:03 | 68 次阅读 | 评论: 0 | 来源: 网络整理

<c:set>标记是setProperty动作的JSTL的版本。该标签是有用的,因为它计算一个表达式,并使用结果来设定一个JavaBean或java.util.Map对象的值。

属性:

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

属性 描述 Required Default
value 需要保存的信息 No body
target Name of the variable whose property should be modified No None
property Property to modify No None
var Name of the variable to store information No None
scope Scope of variable to store information No Page

如果指定目标,属性也必须指定。

例子:


<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title><c:set> Tag Example</title>
</head>
<body>
<c:set var="salary" scope="session" value="${2000*2}"/>
<c:out value="${salary}"/>
</body>
</html>

这将产生以下结果:


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

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