How can I display a JBoss property in JSTL (without using Java)?

663 Views Asked by At

I’m using JBoss 7.1.3 and Spring 3.2.11.RELEASE. I have this property defined in my $JBOSS_HOME/standalone/configuration/standalone.xml file

<system-properties>
    <property name=“myProperty” value=“myValue”/>
    …

In my JSP, through JSTL, is it possible to access this value without any additional code in a Java servlet? If I need to put something in a Spring XML application context file to accommodate this, that’s fine with me.

1

There are 1 best solutions below

2
On

Assuming those are real system properties, just add a ServletContextListener to your application, and in its contextInitialized() method, store the system properties in the servlet context:

servletContext.setAttribute("systemProperties", System.getProperties());

Then, in any JSP:

<c:out value="${systemProperties.myProperty}"/>