【JSP JSTL】<c:if>多个判断条件 + <c:foreach>满足条件跳出循环

有一个需求,将所拥有的权限存放于session中,现在JSP页面判断这些如果在所有权限中有某一个或者某几个,就显示相对应的页面内容

举一个例子,实现以上的逻辑,<c:if>多个判断条件 + <c:foreach>满足条件跳出循环

<c:set var="flag" value="true" />
        <c:forEach items="${authoritys}" var="a">
            <c:if test="${(a.authorityName =='基因信息' || a.authorityName =='基因文献' || a.authorityName =='基因文集')&& flag==true }">
            <c:set var="flag" value="false" />
                <dl id="menu-article">
                    <dt><i class="Hui-iconfont">&#xe616;</i> 综合信息查询<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i></dt>
                    <dd>
                        <ul>
                            <c:forEach items="${authoritys}" var="a">
                                <c:if test="${a.authorityName =='基因信息' }">
                                    <li><a _href="../geneInfo/queryAll.htmls?queryType=product" href="javascript:void(0)">基因信息管理</a></li>
                                </c:if>
                            </c:forEach>
                            <c:forEach items="${authoritys}" var="a">
                                <c:if test="${a.authorityName =='基因文集' }">
                                    <li><a _href="../corlib/queryAll.htmls?queryType=corlib" href="javascript:void(0)">基因文集管理</a></li>
                                </c:if>
                            </c:forEach>    
                            <c:forEach items="${authoritys}" var="a">
                                <c:if test="${a.authorityName =='基因文献' }">
                                    <li><a _href="../fileDeal/myFile.htmls" href="javascript:void(0)">基因文献管理</a></li>
                                </c:if>
                            </c:forEach>
                        </ul>
                    </dd>
                </dl>
            </c:if>
        </c:forEach>
原文地址:https://www.cnblogs.com/sxdcgaq8080/p/6807811.html