<c:choose>
<c:choose>本身只当做 <c:when> 和 <c:otherwise> 的父标签。
语法
<c:choose>
本体内容( <when> 和 <otherwise> )
</c:choose>
属性
无
限制
<c:choose>的本体内容只能有:
·空白
·1或多个 <c:when>
·0或多个 <c:otherwise>
说明
若使用<c:when>和<c:otherwise>来做流程控制时,两者都必须为<c:choose>的子标签,即:
<c:choose>
:
<c:when>
</c:when>
:
<c:otherwise>
</c:otherwise>
:
</c:choose>
● <c:when>
<c:when> 的用途就和我们一般在程序中用的when一样。
语法
<c:when test="testCondition" >
本体内容
</c:when>
属性
名 称
说 明
EL
类型
必须
默认值
test
如果表达式的结果为true,则执行本体内容,false则相反
Y
boolean
是
无
限制
・<c:when> 必须在 <c:choose> 和 </c:choose>之间
在同一个・ <c:choose> 中时,<c:when> 必须在 <c:otherwise> 之前
说明
<c:when>必须有test属性,当test中的表达式结果为true时,则会执行本体内容;如果为false时,则不会执行。