如何在Spring Security Taglib中不提及hasRole('ROLE_ADMIN')
问题内容:
我将如何使用Spring Security Taglib编写以下条件?
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<sec:authorize access="not of hasRole('ROLE_ADMIN')">
<div> show these for only non admins </div>
</sec:authorize>
问题答案:
<sec:authorize access="!hasRole('ROLE_ADMIN')">
<div> show these for only non admins </div>
</sec:authorize>