设为首页 加入收藏

TOP

SpringMVC的乱码处理
2015-07-26 13:13:59 】 浏览:6624
Tags:SpringMVC 乱码 处理

最近因为修改Spring事务的原因,修改了SpringMVC的配置文件,可是最后发现使用AJAX获取后台数据是出现乱码问题。最后发现是因为SpringMVC配置文件中新增了个标签:


引起的,因为之前在配置文件有这样的配置:








text/plain;charset=UTF-8







如果增加上标签,则这个配置将会失效。由于着急,没有跟源码,直接问度娘,有网友说加上如此代码问题可以解决:







application/json;charset=UTF-8





这个时候编辑器报错,说annotaion-driver标签里不能包含子元素。我去,网友怎么呢蒙人呢,后来发现是因为XSD文件版本低了,于是我换成了3.2版本的,问题解决。修改XSD引入代码如:



xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.2.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">


如果你是其他版本也可以换成其他版本,地址在:http://www.springframework.org/schema/mvc/


所以每种问题的解决都受其环境局限,没有什么技术含量,记下来万一能帮上其他网友呢。


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Android Studio实用插件整理,打.. 下一篇Linux控制台下密码输入解决方案

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目