如何在spring security taglib中不提及hasRole('ROLE_ADMIN')

时间:2013-10-11 05:49:46

标签: java spring spring-mvc spring-security taglib

如何使用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>

1 个答案:

答案 0 :(得分:44)

<sec:authorize access="!hasRole('ROLE_ADMIN')">
   <div> show these for only non admins </div>
</sec:authorize>