birdy
birdy

Reputation: 9636

Using spring:eval inside hasRole

I'm displaying certain properties from property file in a JSP like so:

<spring:eval expression="@propertyConfigurer.getProperty('myproperty')"/>

Now, I'd like to use the same property inside <sec:authorize access="hasRole()/>

<sec:authorize access="hasRole('<spring:eval expression="@propertyConfigurer.getProperty('myproperty')"/>')">

which doesn't work.

Upvotes: 2

Views: 1911

Answers (1)

Maksym Demidas
Maksym Demidas

Reputation: 7817

Try this:

<spring:eval expression="@propertyConfigurer.getProperty('myproperty')" var="myproperty"/>
<sec:authorize access="hasRole('${myproperty}')">

Upvotes: 1

Related Questions