【问题标题】:How to iterate over an returned spring security tag using jstl c:foreach如何使用 jstl c:foreach 遍历返回的 spring 安全标签
【发布时间】:2012-10-12 10:38:22
【问题描述】:

在我使用 Spring Security 的应用程序中,我需要遍历返回的权限

<sec:authentication property="authorities"/>

所以我这样做:

<c:forEach var="auth" items="${'<sec:authentication property="authorities"/>'}" >
   <h3> Each- <c:out value="${auth.authority }"></c:out> </h3><br />
</c:forEach>

但它不起作用。这是控制台中的错误:

SEVERE: Servlet.service() for servlet [appServlet] in context with path [/portal] threw exception [Request processing failed; nested exception is org.apache.tiles.impl.CannotRenderException: ServletException including path '/WEB-INF/views/layouts/standard.jsp'.] with root cause org.apache.jasper.JasperException: /WEB-INF/views/resman/about/about.jsp (line: 40, column: 85) equal symbol expected

有什么帮助吗?

【问题讨论】:

    标签: spring-mvc spring-security jstl


    【解决方案1】:

    将权限分配给新变量,然后执行循环:

    <sec:authentication property="authorities" var="authorities" />
    <c:forEach items="${authorities}" var="auth">
       <h3>Each- ${auth.authority}</h3>
    </c:forEach>
    

    【讨论】:

      猜你喜欢
      • 2011-01-10
      • 2020-08-23
      • 1970-01-01
      • 2013-08-18
      • 2018-03-22
      • 2013-01-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多