jstl 的<c:if>标签没有else的解决办法
来源:互联网 发布:升调降调软件 编辑:程序博客网 时间:2024/06/11 09:59
我们可以采用<c:choose>来代替<c:if>
具体结构:
<c:choose>
<c:when test=""> 如果
</c:when>
<c:otherwise> 否则
</c:otherwise>
</c:choose>
代码示例:
<c:choose>
<c:when test="${sessionScope.USERTYPE == 'inner'}">
<c:set value="${context_root}/igmgr/MEB004.dow" var="action" scope="page"/>
</c:when>
<c:when test="${sessionScope.USERTYPE == 'merc'}">
<c:set value="${context_root}/igmgr/MEB021.dow" var="action" scope="page"/>
</c:when>
<c:otherwise>
<c:set value="${context_root}/igmgr/MEB020.dow" var="action" scope="page"/>
</c:otherwise>
</c:choose>
范例说明:当condition1为true时,会显示“condition1为true”;当condition1为false且condition2为true时,会显示“condition2为true”,如果两者都为false,则会显示“condition1和condition2都为false”。
注意:假若condition1和condition2两者都为true时,此时只会显示"condition1为true",这是因为在同一个<c:choose>下,当有好几个<c:when>都符合条件时,只能有一个<c:when>成立。
- jstl 的<c:if>标签没有else的解决办法
- C标签中jstl的if else
- JSTL 的 if else : 有 c:if 没有 else 的处理
- JSTL 的 if else : 有 c:if 没有 else 的处理
- JSTL 的 if else : 有 c:if 没有 else 的处理
- JSTL 的 if else : 有 c:if 没有 else 的处理
- JSTL 的 if else : 有 c:if 没有 else 的处理
- JSTL 的 if else : 有 c:if 没有 else 的处理
- JSTL 的 if else : 有 c:if 没有 else 的处理
- 如何实现JSTL if else if else 的jsp标签
- C标签的if else
- JSTL标签中c:choose,c:when,c:otherwise 可以实现if...else if..else的用法
- JSTL标签用法if else c标签
- JSTL中解决c:if没有else
- jstl中c标签if-else
- jstl中c标签if-else
- JSTL中类似if else的标签使用例子
- <c:if>没有<c:else>解决办法
- std::less()用法及分析分析
- 信息学奥林匹克竞赛-陶陶摘苹果
- 使用Struts2简单的基本文件上传下载实现
- android RootTooles 分享
- SQL Server: 索引禁用、启用状态对比测试
- jstl 的<c:if>标签没有else的解决办法
- Git 常用命令整理
- c++11线程安全的队列的类的定义
- 在ubuntu中安装jdk以及环境配置
- [Mysql数据库] 每天自动备份mysql脚本
- c++ friend functions and inline functions
- AndroidStudio快捷键Editing
- C++ math库函数
- android developers 最新镜像 2015-11-26