接触springMVC不够深入,乱码困扰我到深夜,特此留下记忆:
@responsebody默认滴是那个什么8859-1滴狗屁编码,需要在配置文件中加入如下代码转换:
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" >
<property name="messageConverters">
<list>
<bean class = "org.springframework.http.converter.StringHttpMessageConverter">
<property name = "supportedMediaTypes">
<list>
<value>text/html;charset=UTF-8</value>
</list>
</property>
</bean>
</list>
</property>
</bean>