<c:if test>标签使用

1>test命令之数字test
语法:
[ number relation number ] 通过关系运算符来对数字进行比较
关系运算符:
-lt    小于
-le     小于或者等于
-gt    大于
-ge    大于或者等于
-eq    等于
-ne    不等于

Java代码 复制代码   收藏代码
  1. //count>1   
  2. <c:if test="${count eq 1}">(equals)等于1</c:if>   
  3. //count!=1   
  4. <c:if test="${count ne 1}">(equals)不等于1</c:if>   
  5.   
  6. //count>=2   
  7. <c:if test="${count ge 2}">(gt eq)大于等于2<c:if>   
  8. //count<2   
  9. <c:if test="${count le 2}">(lt eq小于等于2<c:if>   
  10.   
  11. //count>1   
  12. <c:if test="${count gt 1}">(gt)大于1<c:if>   
  13. //count<1   
  14. <c:if test="${count lt 1}">(lt)大于1<c:if>  
//count>1
<c:if test="${count eq 1}">(equals)等于1</c:if>
//count!=1
<c:if test="${count ne 1}">(equals)不等于1</c:if>

//count>=2
<c:if test="${count ge 2}">(gt eq)大于等于2<c:if>
//count<2
<c:if test="${count le 2}">(lt eq小于等于2<c:if>

//count>1
<c:if test="${count gt 1}">(gt)大于1<c:if>
//count<1
<c:if test="${count lt 1}">(lt)大于1<c:if>


2>输出
Java代码 复制代码   收藏代码
  1.    <c:if test="${param.username = = 'admin' }">   
  2.   ADMIN您好!! //body部分   
  3.   </c:if>  
   <c:if test="${param.username = = 'admin' }">
  ADMIN您好!! //body部分
  </c:if>


3>判空
Java代码 复制代码   收藏代码
  1. <c:if test="${empty count }"></c:if>  
  • 1
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值