Spring 无法检索具有ExposeContextBeanSatAttribute的属性
目前正在使用spring“exposedContextBeanNames”来允许我在视图中显示属性,但在某些包含“.”的属性上存在签名问题 我的xml设置为Spring 无法检索具有ExposeContextBeanSatAttribute的属性,spring,spring-mvc,jstl,Spring,Spring Mvc,Jstl,目前正在使用spring“exposedContextBeanNames”来允许我在视图中显示属性,但在某些包含“.”的属性上存在签名问题 我的xml设置为 <bean id="properties" class="org.springframework.beans.factory.config.PropertiesFactoryBean"> <property name="locations"> <list><value>
<bean id="properties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="locations">
<list><value>classpath:servers.properties</value> </list>
</property>
</bean>
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
<property name="prefix" value="/WEB-INF/views/"/>
<property name="suffix" value=".jsp"/>
<property name="exposeContextBeansAsAttributes" value="true"/>
<property name="exposedContextBeanNames">
<list>
<value>properties</value>
</list>
</property>
</bean>
在我的JSP中
${properties.value1}
将按预期显示“这是第一个值”,但
${properties.value.value1}
不起作用。我希望有人能帮助我。谢谢尝试
${properties['value.value1']}
如果我的属性文件看起来像这样,您是否知道是否可以这样做;value1=${my.env.value},其中它将获取环境值。如果我试图打印这个值,我会得到字符串“${my.env.value}”来代替env-value.supernable-answer:)谢谢@axtavt:)
${properties.value.value1}