代码  jstl标签  c:if和c:choose
  1. <c:if test="${test == null}">test为null</c:if>  


其意思是,如果test 为 null,那么就打印 “test为null” 

那么如果有两个以上的条件呢? 
那么就可以用<c:choose>了,其使用方法: 

代码  jstl标签  c:if和c:choose
  1. <c:choose>   
  2.   <c:when test="expression">   
  3.         body content   
  4.   </c:when>   
  5.   <c:when test="expression">   
  6.         body content   
  7.   </c:when>   
  8.   ...   
  9.   <c:otherwise>   
  10.         body content   
  11.   </c:otherwise>   
  12. </c:choose>   


相当于java 语言的switch case用法,进来一个变量,根据不同判断,得到最终的一个结果

相关文章:

  • 2021-09-03
  • 2022-12-23
  • 2021-10-05
  • 2021-09-16
  • 2021-12-31
  • 2022-12-23
  • 2022-12-23
  • 2021-09-16
猜你喜欢
  • 2021-09-16
  • 2021-09-26
  • 2022-12-23
  • 2021-09-16
  • 2022-12-23
相关资源
相似解决方案