<c:if ...的使用

首先加入 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

 

Jsp代码   收藏代码
  1.  <c:if test= "${queryType == '1'}" >  
  2.     <c:if test="${ infoType == '0'}" >  
  3.         <div class="ttl_bar ttl_16" >南京一日游</div>  
  4.     </c:if>  
  5.     <c:if test="${ infoType == '1'}" >  
  6.         <div class="ttl_bar ttl_16" >南京周边游</div>  
  7.     </c:if>  
  8.     <c:if test="${ infoType == '2'}" >  
  9.         <div class="ttl_bar ttl_16" >境内游</div>  
  10.     </c:if>  
  11.     <c:if test="${ infoType == '3'}" >  
  12.         <div class="ttl_bar ttl_16" >境外游</div>  
  13.     </c:if>  
  14.     <c:if test="${ infoType == '4'}" >  
  15.         <div class="ttl_bar ttl_16" >自驾游</div>  
  16.     </c:if>  
  17. </c:if>  

 利用传入的queryType的值判断显示的内容

其中<c:if test=""></c:if>中test的内容的结果只能是布尔值

另外判断时候为空:<c:if test="${empty id}">、<c:if test="${!empty id}">

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值