条件标签

来源:互联网 发布:mac 流程图工具 免费 编辑:程序博客网 时间:2024/05/14 09:02

<c:if>标签
<c:if>标签用来做条件判断,功能类似于JSP中的<%if(boolean){}%>。
语法:
<c:if test="condition" var="varName" [scope=""]/>
<c:if test="condition" var="name" scope=""></c:if>
【示例5】<c:if>的用法

 

<c:choose>、<c:when>、<c:otherwise>标签
<c:choose>标签用于提供条件选择的上下文,它必须与<c:when>和<c:otherwise>标签一起使用。
<c:when>作为<c:choose>的子标签,<c:when>有一个test属性,该属性的值为布尔型,如果test的值为true,则执行<c:when>标签体的内容。
<c:otherwise>标签没有属性,它必须作为<c:choose>标签的最后分支出现

语法格式:
<c:choose>
<c:when test=''condition">条件为true的时候执行</c:when>(一个或多个)
<c:otherwise></c:otherwise>(零个或者一个)
</c:choose>

原创粉丝点击