javaScript的if else你们都不会陌生,但可能不少小伙伴并不知道在jsp文件里,el表达式的if else是怎么写的,下面安利给各位小伙伴。html
<c:if test="${jsonObject.transportTypeName eq '火车'}"> <li><span>运费</span><span class="orderdetails-jiage-1">0</span></li> </c:if>
示例2java
<c:if test="${empty currentRoleId}"> currentRoleId为空 </c:if> <c:if test="${not empty currentRoleId}"> currentRoleId不为空 </c:if>
示例3json
<c:when test="${condition1}"> condition1为true </c:when>
<c:choose> <c:when test="${jsonObject.transportTypeName eq '火车' || '散船' || '自提' || '集装箱' || '集装箱自提' || '汽车'}"> <li><span>运费</span><span class="orderdetails-jiage-1">0</span></li> </c:when> <c:otherwise> <li><span>运费</span><span class="orderdetails-jiage-1">¥${jsonObject.deliveryFee == null ? 0.00 : jsonObject.deliveryFee}</span></li> </c:otherwise> </c:choose>
示例2jsp
<c:choose> <c:when test="${var.index % 2 == 0}"> * </c:when> <c:otherwise> * </c:otherwise> </c:choose>
示例3spa
<c:choose> <c:when test="${Object.Name != null}"> * </c:when> <c:otherwise> * </c:otherwise> </c:choose>