1

在我使用 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

有什么帮助吗?

4

1 回答 1

6

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

<sec:authentication property="authorities" var="authorities" />
<c:forEach items="${authorities}" var="auth">
   <h3>Each- ${auth.authority}</h3>
</c:forEach>
于 2012-10-12T11:00:32.830 回答