什么是<c:otherwise>

核心提示<c:otherwise>是一种计算机编程的语言中文名<c:otherwise>释义计算机编程的语言<c:otherwise>简介在同一个 <c:choose> 中,当所有 <c:when> 的条件都没有成立时,则执行 <c:otherwi

最佳答案:

<c:otherwise>是一种计算机编程的语言

详情介绍

<c:otherwise>是一种计算机编程的语言

中文名
<c:otherwise>
释义
计算机编程的语言

<c:otherwise>简介

在同一个 <c:choose> 中,当所有 <c:when> 的条件都没有成立时,则执行 <c:otherwise> 的本体内容。

<c:otherwise>语法

<c:otherwise>

本体内容

</c:otherwise>

属性

无

限制

·<c:otherwise> 必须在 <c:choose> 和 </c:choose>之间

·在同一个 <c:choose> 中时,<c:otherwise> 必须为最后一个标签

说明

在同一个 <c:choose> 中,假若所有 <c:when> 的test属性都不为true时,则执行 <c:otherwise> 的本体内容。

范例

笔者举一个典型的 <c:choose>、<c:when>和<c:otherwise>范例:

<c:choose>

<c:when test="${condition1}">

condition1为true

</c:when>

<c:when test="${ condition2}">

condition2为true

</c:when>

<c:otherwise>

condition1和condition2都为false

</c:otherwise>

</c:choose>

范例说明:当condition1为true时,会显示“condition1为true”;当condition1为false且condition2为true时,会显示“condition2为true”,如果两者都为false,则会显示“condition1和condition2都为false”。

<c:otherwise>注意

假若condition1和condition2两者都为true时,此时只会显示"condition1为true",这是因为在同一个<c:choose>下,当有好几个<c:when>都符合条件时,只能有一个<c:when>成立。

 
友情链接
鄂ICP备19019357号-22