jstl 多个判断条件正确的写法

时间:2021-02-16 02:58:14

用jstl 的if 或者 when 判断多个条件的时候我不小心写成这样了

<c:when  test="${channelItem.itemTag =='channel_name'}|| ${channelItem.itemTag =='mobile'}">
     <input type="text" name="itemPlaceholder" class="g-input iptTitle w-100p" value="${channelItem.itemPlaceholder}"  placeholder="可设置提示语">
       <span class="sort"><a class="up" href="javascript:;"></a><a class="down disabled" href="javascript:;"></a></span>
 </c:when>

其实上面的写法是错误的应该写成一下这种


<c:when  test="${channelItem.itemTag =='channel_name'|| channelItem.itemTag =='mobile'}">
   <input type="text" name="itemPlaceholder" class="g-input iptTitle w-100p" value="${channelItem.itemPlaceholder}"  placeholder="可设置提示语">
   <span class="sort"><a class="up" href="javascript:;"></a><a class="down disabled" href="javascript:;"></a></span>
 </c:when>

虽然很简单,可是有时候脑一抽筋就犯错了0.0.