【问题标题】:Using spring:eval inside hasRole在 hasRole 中使用 spring:eval
【发布时间】:2013-02-27 23:18:27
【问题描述】:

我在 JSP 中显示属性文件中的某些属性,如下所示:

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

现在,我想在 &lt;sec:authorize access="hasRole()/&gt; 中使用相同的属性

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

这是行不通的。

【问题讨论】:

  • 你试过这个吗: ?

标签: java spring spring-mvc spring-security


【解决方案1】:

试试这个:

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

【讨论】:

  • 知道如何在一些基本的html标签上使用${myproperty}吗?例如:` 不工作。
  • 想通了。这里是jsphere是加载属性文件的java类。
猜你喜欢
  • 2016-06-23
  • 1970-01-01
  • 2013-07-04
  • 1970-01-01
  • 1970-01-01
  • 2020-04-03
  • 2021-04-07
  • 2015-05-02
  • 2018-04-23
相关资源
最近更新 更多