Spring mvc 国际化支持已经UTF-8中文乱码问题的解决方案

原文地址为: Spring mvc 国际化支持已经UTF-8中文乱码问题的解决方案

Spring mvc 国际化支持已经UTF-8中文乱码问题的解决方案

    1、在SPRING的配置文件中添加国际化支持:

<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="/WEB-INF/classes/messages"/>
<property name="cacheSeconds" value="0" />
<property name="defaultEncoding" value="UTF-8"/>
</bean>

defaultEncoding
value utf-8可以解决乱码文件,
 
2、在src下新建配置文件:
   
messages.properties  messages_cn_ZH.properties messages_en_US.properties 等等。

 
3、在JSP中调用
  
<spring:messagecode="projectname"/>




转载请注明本文地址: Spring mvc 国际化支持已经UTF-8中文乱码问题的解决方案

猜你喜欢

转载自blog.csdn.net/wcqlwyt/article/details/80923822