jsp里的逻辑语句c:if和c:choose

1.c:if

<c:if test=""></c:if>

c:when的test里可以是变量或者是一个EL表达式,其结果应该是true或者false。

EL表达式具体参考http://blog.csdn.net/yolanda_nuonuo/article/details/52680036

2.c:choose

<c:choose>

        <c:whentest="">

                情况一

        </c:when>

        <c:otherwise>

                情况二

       </c:otherwise>

</c:choose>

3.c:forEach

<c:forEachbegin="1"end="3" step="1"varStatus="leftInfo">

<divid="leftInfo${leftInfo.current}">

</div>

</c:forEach>

这里的${leftInfo.current}会从1取到3

4.根据条件改变一个class

<divclass="boarding<c:if test=''>_p</c:if>" >

可以在css文件中写两个属性,一个是boarding一个是boarding_p

 
原文地址:https://www.cnblogs.com/haimishasha/p/6219627.html