Struts2 ifタグ
テンプレート:Include html banner html, "!Struts"
条件分岐、if単体および、elseIf、else と併せて利用
if
パラメータ
| タグ名
|
必須
|
デフォルト
|
評価
|
型
|
内容
|
| id
|
false
|
|
true
|
String
|
要素参照用ID. UIや、FORMタグ用。HTMLのid属性として利用される。
|
| test
|
true
|
|
true
|
Boolean
|
タグの内容を表示するか決定する式。
|
elseIf
パラメータ
| タグ名
|
必須
|
デフォルト
|
評価
|
型
|
内容
|
| id
|
false
|
|
true
|
String
|
要素参照用ID. UIや、FORMタグ用。HTMLのid属性として利用される。
|
| test
|
true
|
|
true
|
Boolean
|
タグの内容を表示するか決定する式。
|
else
パラメータ
| タグ名
|
必須
|
デフォルト
|
評価
|
型
|
内容
|
| id
|
false
|
|
true
|
String
|
要素参照用ID. UIや、FORMタグ用。HTMLのid属性として利用される。
|
使用例
<s:if test="%{false}">
<div>Will Not Be Executed</div>
</s:if>
<s:elseif test="%{true}">
<div>Will Be Executed</div>
</s:elseif>
<s:else>
<div>Will Not Be Executed</div>
</s:else>
テンプレート:Include html banner html, "!Struts"