EL在<sec:authorize>访问属性</sec:authorize>中

时间:2011-12-14 19:57:54

标签: spring spring-mvc spring-security

是否无法在访问属性中使用EL?我不喜欢在标签中硬编码角色名称,而是想使用常量。但这是一个例外,说:

org.apache.jasper.JasperException: abc.jsp(19,4) According to TLD or
attribute direc tive in tag file, attribute access does not accept
any expressions

Here is what I have in jsp(using unstandard taglib for constants):

<%@taglib uri="http://jakarta.apache.org/taglibs/unstandard-1.0" prefix="un"%>
<un:useConstants className="com.xxx.PrivilegeConstants" var="privilege" />
.....

<sec:authorize access="hasRole('${privilege.USER_ROLE}')">  // throwing ex here
   security content here....
</sec:authorize>    

Is there any other alternative? Thanks in advance...

1 个答案:

答案 0 :(得分:2)

看起来后来添加了支持。参见JIRA here。我想,使用添加此支持的版本应该可行。