提示消息资源文件及其编码均位于spring的bean配置文件中,样式如下:
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="/WEB-INF/resource/messages"></property>
<property name="defaultEncoding" value="UTF-8"></property>
</bean>其中basename属性指定消息资源文件的位置,spring会自动为其加上区域代码和properties扩展名。defaultEncoding属性指定该文件的编码。

本文介绍了Spring框架中如何配置消息资源文件,包括basename属性用于指定文件位置,spring自动添加区域代码及properties扩展名;defaultEncoding属性则用于指定文件编码。

被折叠的 条评论
为什么被折叠?



