• 【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>
  • 相关阅读:
    容灾、备份、存储
    春节前后学习实践的技术领域
    C#高级编程技术复习一
    利用投影制作多边框
    利用循环调用同一个函数
    IOS NSURLRequest(http请求)讲解 ---------赎罪之路
    IOS SQLite基本操作
    数据库三凡式通俗解析(转载)
    数据库设计原则(转载)
    MusicRadio ----------项目分享
  • 原文地址:https://www.cnblogs.com/sxdcgaq8080/p/6807811.html
Copyright © 2020-2023  润新知