如何在JSP中的spring批注中访问静态变量?

时间:2019-05-14 19:22:14

标签: spring jsp spring-security el

我们正在使用Spring Security根据许可级别提供内容。例如:

<security:authorize access="hasAnyAuthority('authority1','authority2')">
</security:authorize>

但是,必须在同一JSP文件的许多位置添加此标记。我们要在变量中定义权限列表,并将其传递给hasAnyAuthority批注。像这样

<security:authorize access="hasAnyAuthority(${authorityList})">
</security:authorize>

有人知道吗?

我们希望在JSP中实现相同的功能 Using static variables in Spring annotations

我尝试将列表添加到bean中,并能够使用<jsp:beans>

检索bean。

但是,如果我使用该变量,它将引发SPEL异常

0 个答案:

没有答案