Skip to content

Instantly share code, notes, and snippets.

@abickford
Created June 21, 2013 13:53
Show Gist options
  • Save abickford/5831317 to your computer and use it in GitHub Desktop.
Save abickford/5831317 to your computer and use it in GitHub Desktop.
Evaluating Java System Properties in JSP
Spring context XML:
<!-- expose specific properties to application -->
<bean id="applicationProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="singleton" value="true" />
<property name="properties">
<props>
<prop key="frontleaf.enabled">${frontleaf.enabled}</prop>
<prop key="frontleaf.streamname">${frontleaf.streamname}</prop>
</props>
</property>
</bean>
JSP:
<spring:eval expression="@applicationProperties.getProperty('frontleaf.enabled')" var="frontleafEnabled" />
<c:if test="${frontleafEnabled}">
<spring:eval expression="@applicationProperties.getProperty('frontleaf.streamname')" var="frontleafStreamname" />
<script>
....
</script>
</c:if>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment