Flask接口签名sign原理与实例代码浅析
339
2023-03-05
spring+mybatis 通过@ResponseBody返回结果中文乱码的解决方法
问题发生:
通过@Responsebody返回
@ResponseBody
@RequestMapping(value ="/selectByFormId",method = RequestMethod.GET)
public Map
http://List
Map
map.put("data", list);
map.put("status", true);
return map;
}
结果:
{"data":["璧勮璇疯喘绫�","淇冮攢绫�","绠$悊绫�","鏆傛敮绫�","鍌ㄨ繍绫�","璧勪骇绫�","璧勮鏈嶅姟绫�","宸梾绠$悊绫�",
"閲囪喘绫�","浜轰簨鑰冨嫟绫�","璐㈠姟绫�","瀹㈡埛绫�","瑙嗘嫇绫�","瀹㈣瘔绫�","浜轰簨娲诲姩绫�","浜轰簨琛屾斂绫�","鍏枃绫�",
"璇锋绫�","閿?绠$被","钀ヨ繍涓氬姟绫�"],"status":true}
解决办法:
在spring-mvc.xml中配置
但是配置完后又有了新的问题
error:...cvc-complex-type.2.1: 元素 'mvc:annotation-driven' 必须不含字符或元素信息项 [子级], 因为该类型的内容类型为空。
后来知道是 springMVC的XSD文件版本不对,换成springMVC 4.0的 XSD就可以了
xmlns:xsi="http://w3.org/2001/XMLSchema-instance" xmlns:p="http://springframework.org/schema/p" xmlns:context="http://springframework.org/schema/context" xmlns:mvc="http://springframework.org/schema/mvc" xsi:schemaLocation="http://springframework.org/schema/beans http://springframework.org/schema/beans/spring-beans-3.1.xsd http://springframework.org/schema/context http://springframework.org/schema/context/spring-context-3.1.xsd http://springframework.org/schema/mvc http://springframework.org/schema/mvc/spring-mvc-4.0.xsd"> 然后就ok了 {"data":["资讯请购类","促销类","管理类","暂支类","储运类","资产类","资讯服务类","差旅管理类","采购类","人事考勤类" StringHttpMessageConverter 这个方法 有很多转换作用,有时间可以多看看
,"财务类","客户类","视拓类","客诉类","人事活动类","人事行政类","公文类","请款类","销管类","营运业务类"],"statnbYlcTUQIXus":true}
xmlns:xsi="http://w3.org/2001/XMLSchema-instance" xmlns:p="http://springframework.org/schema/p"
xmlns:context="http://springframework.org/schema/context"
xmlns:mvc="http://springframework.org/schema/mvc"
xsi:schemaLocation="http://springframework.org/schema/beans
http://springframework.org/schema/beans/spring-beans-3.1.xsd
http://springframework.org/schema/context
http://springframework.org/schema/context/spring-context-3.1.xsd
http://springframework.org/schema/mvc
http://springframework.org/schema/mvc/spring-mvc-4.0.xsd">
然后就ok了
{"data":["资讯请购类","促销类","管理类","暂支类","储运类","资产类","资讯服务类","差旅管理类","采购类","人事考勤类"
,"财务类","客户类","视拓类","客诉类","人事活动类","人事行政类","公文类","请款类","销管类","营运业务类"],"statnbYlcTUQIXus":true}
StringHttpMessageConverter 这个方法 有很多转换作用,有时间可以多看看
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~