spring-servlet.xml中配置
<!-- 处理ajax返回值时候乱码 -->
<mvc:annotation-driven>
<mvc:message-converters register-defaults="true">
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes" value="text/plain;charset=UTF-8" />
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
?
?
ajax方法上写
@RequestMapping(value = "/list.do", produces = "text/plain; charset=UTF-8")
@ResponseBody
public String list(PtDataUserDO entity) throws Exception {
?
?
注意两个地方都需要注明utf-8,缺一不起作用。网上给的答案恶心死我了。