Jsp-jstl-core-set-tag

提供:Dev Guides
移動先:案内検索

JSTL-コア<c:set>タグ

*<c:set>* タグは、 *setProperty* アクションのJSTLフレンドリーバージョンです。 このタグは、式を評価し、その結果を使用してJavaBeanまたは* java.util.Mapオブジェクト*の値を設定するので便利です。

属性

*<c:set>* タグには次の属性があります-
Attribute Description Required Default
Value Information to save 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