EL表达式多条件判断方式

JAVA学习网 2018-01-27 09:20:02
 1 <td>
 2                 <c:forEach items="${cityMap}" var="entry">
 3                     <hr>
 4                     <input type="checkbox" class="chooseAll"><strong>${entry.key}</strong><br>
 5                     <hr>
 6                     <c:if test="${entry.key ne '澳门特别行政区'}">
 7                     <c:if test="${entry.key ne '香港特别行政区'}">
 8                     <c:if test="${entry.key ne '北京市'}">
 9                     <c:if test="${entry.key ne '天津市'}">
10                     <c:if test="${entry.key ne '重庆市'}">
11                         <c:if test="${entry.key ne '上海市'}">
12                         <c:forEach items="${entry.value}" var="str">
13                             <input class="douc" type="checkbox" value="${str}" name="area">${str}
14                         </c:forEach>
15                     </c:if>
16                     </c:if>
17                     </c:if>
18                     </c:if>
19                     </c:if>
20                     </c:if>
21                     <br>
22                 </c:forEach>
23             </td>

本想都写在一个if里,如

1  <c:if test="${entry.key ne '澳门特别行政区'
2                    ||entry.key ne '香港特别行政区' ....
3     }">    

事实证明这样写页面会出问题

阅读(755) 评论(0)