springMvc 处理国际化是前台页面出现乱码,如下所示:
假设此时使用的是Session进行国际化(三种国际化都一样),解决办法:
1. 在 springMvc中配置:
<!--国际化-->
<bean class="org.springframework.context.support.ResourceBundleMessageSource" id="resourceBundleMessageSource">
<!--国际化文件资源名-->
<property name="basename" value="messages"/>
<!-- 支持UTF-8的中文 -->
<property name="cacheSeconds" value="0"/>
<property name="defaultEncoding" value="UTF-8"/>
</bean>
2.修改 .properties配置文件的编码:
在File ——> Settings --> Editor --> File Encodings下修改
Default Encoding for properties files:为 UTF-8 即可。
3.进行正常的国际化编码