jstl 的判断使用

1.必须引入的头部标签

  1. <%@ taglib uri="http://java.sun.com/jstl/core_rt"prefix="c" %> 
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>

 

2.内容部分

  1. <table> 
  2.     <tr> 
  3.         <td> 
  4.             服务器 
  5.         </td> 
  6.         <td> 
  7.             版本号 
  8.         </td> 
  9.         <td> 
  10.             业务名称 
  11.         </td> 
  12.         <td> 
  13.             省份 
  14.         </td> 
  15.         <td> 
  16.             用户数量 
  17.         </td> 
  18.         <td> 
  19.             业务类型 
  20.         </td> 
  21.         <td> 
  22.             发送条数 
  23.         </td> 
  24.         <td> 
  25.             地区限量(次数) 
  26.         </td> 
  27.         <td> 
  28.             业务开通省份 
  29.         </td> 
  30. </tr> 
  31. <c:forEachitems="${pseList}"var="pse"> 
  32.     <tr> 
  33.         <td> 
  34.             <c:iftest="${‘119.120.92.138‘ == pse.softIp}"> 
  35.                 <fontcolor="#f47920">${pse.softIp }</font> //颜色1 
  36.             </c:if> 
  37.                 <c:iftest="${‘119.120.92.139‘ == pse.softIp}"> 
  38.             <fontcolor="#8552a1">${pse.softIp }</font> //颜色2 
  39.             </c:if> 
  40.                 <c:iftest="${‘121.10.246.59‘ == pse.softIp}"> 
  41.             <fontcolor="#8a2e3b">${pse.softIp }</font> //颜色3 
  42.             </c:if> 
  43.                 <c:iftest="${‘211.154.151.115‘ == pse.softIp}"> 
  44.                 <fontcolor="#bd6758">${pse.softIp }</font> //颜色4 
  45.             </c:if>                
  46.                 <%--  
  47.                     1.以上是jstl的if语句的简单使用。 
  48.                      
  49.                     <c:iftest="${‘119.120.92.138‘ == pse.softIp}"> 
  50.                          
  51.                         pse.softIp得到的结果和字符串比较,所以要加分号; 
  52.                         反之是int的话就不用加咯。                       
  53.                 --%> 
  54.         </td> 
  55.         <td> 
  56.             ${pse.version } 
  57.         </td> 
  58.         <td> 
  59.             <c:choose> 
  60.                 <c:whentest="${‘-空缺-‘==pse.serviceName}"> 
  61.                     <fontcolor="#ef5b9c">${pse.serviceName }</font> 
  62.                 </c:when> 
  63.                 <c:otherwise> 
  64.                     ${pse.serviceName } 
  65.                 </c:otherwise> 
  66.             </c:choose> 
  67.                 <%--  
  68.                     2.以上是jstl的一个判断语句使用,相当于编程语言的 
  69.                         if(...){ 
  70.                             ... 
  71.                         }else{ 
  72.                             ... 
  73.                         } 
  74.                     注意:外面的<c:choose>不能丢哦。 
  75.                 --%> 
  76.         </td> 
  77.         <td> 
  78.             ${pse.provinceName } 
  79.         </td> 
  80.         <td> 
  81.             ${pse.num } 
  82.         </td> 
  83.         <td> 
  84.             ${pse.channelName } 
  85.         </td> 
  86.         <td> 
  87.             ${pse.sendTimes } 
  88.         </td> 
  89.         <td> 
  90.             ${pse.limitNum } 
  91.         </td> 
  92.         <td> 
  93.             ${pse.provinces } 
  94.         </td> 
  95.     </tr>                                          
  96.     </c:forEach>   
  97. </table> 

jstl 的判断使用,布布扣,bubuko.com

jstl 的判断使用

上一篇:.NET开发者必备的11款免费工具


下一篇:自主服务器详细发布网站教程,能上网即可以做网站服务