简体   繁体   中英

How to retrieve property file name in jsp?

I want to get the name of the property file being loaded at the spring initialization (during tomcat container startup) in the JSP during runtime.

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

Where devTarget is being provided by Tomcat's catalina.properties file. And based on this value, a particular property file gets loaded during spring init.

Now I want to read this devTarget in JSP to render something based upon the environment, where devTarget tells the environment.

How should I do this? So that devTarget can be easily accessible in JSP.

Something like:

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM