当前位置: 代码迷 >> Web前端 >> <c:if .的运用
  详细解决方案

<c:if .的运用

热度:108   发布时间:2012-11-23 22:54:33.0
<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}">

  相关解决方案