【问题标题】:Reading a property key in Spring Web MVC 3.2.8 with maven使用 maven 在 Spring Web MVC 3.2.8 中读取属性键
【发布时间】:2016-12-07 12:12:07
【问题描述】:

我的 Spring Web 模型-视图-控制器 (MVC) 框架中有这个类。 Spring Web 模型-视图-控制器 (MVC) 框架的版本是 3.2.8。

在我的 applicationContext.xml 我有这个 bean 定义

<bean id="applicationProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="locations">
<list><value>classpath:config/application.properties</value></list>
</property> 
</bean>

这是文件的内容:

templateName = BLE_NORDIC

但是当我在 JSP 中读取这个属性时,我得到了????

<fmt:message key="templateName"/>'   >

【问题讨论】:

    标签: spring spring-mvc


    【解决方案1】:

    将它们添加为消息资源包

    message.properties

    模板名称 = BLE_NORDIC

    <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"> 
        <property name="basenames"> 
          <list> 
            <value>message</value>  
          </list> 
        </property> 
      </bean>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-01-19
      • 2017-12-15
      • 1970-01-01
      • 2015-08-10
      • 1970-01-01
      • 1970-01-01
      • 2013-01-20
      • 2017-01-07
      相关资源
      最近更新 更多