JSTL 中的相等判断和选择和非空判断的知识点
来源:互联网 发布:mac 应用程序目录 编辑:程序博客网 时间:2024/06/15 12:29
1> 关于JSTL中的选择
当在JSP 页面中 需要判断某个属性相等于多少数值的时候,
这个时候不是用“==”或者.equal(),等判断,而是根据其本身标签库提供的一个函数判断: eq
例如:
//判断标志位是否为 0
<c:if test="${item.flag eq0}"></c:if>
2> JSTL关于选择的情况
JSTL 中有选择的如果属性<c:if>然而,却没有否则属性,如果,先使用 如果……否则 的判断关系,就必须使用
<c:choose>
<c:when> </c:when>
<c:otherwise></c:otherwise>
</c:choose>
例如:
<c:choose>
<c:when test="${item.flag eq 0}">
<tr>
<td height="32" colspan="3" style="font-size: 18px; color: red">${item.startTime}</td>
<tr>
</c:when>
<c:otherwise>
<tr>
<td height="32" colspan="3" style="font-size: 18px; color:green">${item.startTime}</td>
</tr>
</c:otherwise>
</c:choose>
2.1>当然,其实 JSTL 中选择判断的属性也是可以嵌套使用的:
例如:
<c:choose>
<c:when test="${item.flag eq 2}">
<tr>
<td height="32" colspan="3" style="font-size: 18px; color: black">${item.startTime}</td>
<tr>
</c:when>
<c:otherwise>
<c:choose>
<c:when test="${item.flag eq 0}">
<tr>
<td height="32" colspan="3" style="font-size: 18px; color: red">${item.startTime}</td>
<tr>
</c:when>
<c:otherwise>
<tr>
<td height="32" colspan="3" style="font-size: 18px; color:green">${item.startTime}</td>
</tr>
</c:otherwise>
</c:choose>
</c:otherwise>
</c:choose>
- JSTL 中的相等判断和选择和非空判断的知识点
- angularjs的添加和非空判断
- Java集合判断空和非空
- JSTL低版本if判断和字符串相等解决方案
- js 中的null和undefined相等的条件判断
- C++中的变量是否相等 和 Java中的变量是否相等的判断
- C++知识点:double型和float型判断相等
- js中el表达式的使用和非空判断
- VS.NET如何判断DataSet为空和非空
- 如何判断DataSet为空和非空
- Integer 和 int 判断相等
- 字符串比较和相等判断
- C#中的相等判断:==和equals
- iOS_XZ之判断两个数组中的元素相同和相等
- 字符串的截取,判断字符串是否相等和字符串是否为空的方法总结Java,Android
- oracle空字符判断相等
- Javascript 中的非空判断 undefined,null, NaN的区别
- JS中的非空判断 undefined,null, NaN的区别
- 使用PHP对图片进行base64编码和解码
- win8开发(5)——消息框
- Java解决空格和乱码问题
- IOS成长之路-code signing is required for product type 'Application' in SDK 'iOS 6.0'
- MSChart 部署问题
- JSTL 中的相等判断和选择和非空判断的知识点
- CLR C++ Set Word CustomDocumentProperties
- 正则式去格式
- OpenGL学习笔记(一)
- Java编程中“为了性能”需做的26件事
- c++学习总结
- 软件工程师在外企学什么?
- 解决SecureCRT中文显示乱码
- Linux下USB gadget设备详解