【问题标题】:How to retrieve property file name in jsp?如何在jsp中检索属性文件名?
【发布时间】:2016-06-08 10:00:14
【问题描述】:

我想在运行时获取JSP中spring初始化(tomcat容器启动期间)加载的属性文件的名称。

<util:properties id="propertyConfigurer" location="classpath:${devTarget_propertyFileClassPathHere}"/>
<context:property-placeholder properties-ref="propertyConfigurer" />

devTarget 由 Tomcat 的 catalina.properties 文件提供。 并且基于这个值,一个特定的属性文件在 spring init 期间被加载。

现在我想在 JSP 中阅读这个 devTarget 以根据环境呈现一些东西,其中 devTarget 告诉环境。

我该怎么做?这样 devTarget 就可以在 JSP 中轻松访问了。

类似:

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

【问题讨论】:

  • 通过将值存储在 web.xml 的 context-param 中,然后在 jsp 中使用 jstl 来完成此操作。

标签: java spring jsp tomcat spring-properties


【解决方案1】:

通过将值存储在 web.xml 的 context-param 中,然后使用 jstl 在 jsp 中使用它来完成此操作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-04-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多