我正在使用JBoss 7.1.3和Spring 3.2.11.RELEASE。我在$ JBOSS_HOME / standalone / configuration / standalone.xml文件中定义了此属性
<system-properties>
<property name=“myProperty” value=“myValue”/>
…
在我的JSP中,通过JSTL,是否可以在Java servlet中没有任何其他代码的情况下访问此值?如果我需要在Spring XML应用程序上下文文件中放置一些内容以适应这种情况,那对我来说没问题。
答案 0 :(得分:1)
假设这些是真正的系统属性,只需向应用程序添加ServletContextListener,并在其contextInitialized()
方法中将系统属性存储在servlet上下文中:
servletContext.setAttribute("systemProperties", System.getProperties());
然后,在任何JSP中:
<c:out value="${systemProperties.myProperty}"/>