2011-12-14 30 views
1

在訪問屬性中不能使用EL嗎?我不喜歡硬編碼標籤中的角色名稱,而是想使用常量。但它拋出一個異常說:EL in <sec:authorize>訪問屬性

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... 

回答

2

看起來支持稍後添加。請參閱JIRA here。我想,使用增加這種支持的版本應該可以工作。

+0

非常感謝,看起來它已經在3.1中修復了,但我使用的是Spring Security 3.0.5。有趣的是,另一個JIRA [這裏](https://jira.springsource.org/browse/SEC-1456)是相似的,但它在3.0.3中被提及爲固定的,不確定它在3.0.5中不起作用! – varaprakash

+0

現在我使用醜陋的腳本來修復它:(<%@ page import =「com.xxx.PrivilegeConstants」%> ')」> ...在這裏顯示內容.... varaprakash