用layui table接收到的后台数据是中文乱码。

用的是springmvc,设置和请求和响应还有tomcat都是utf-8还是乱码。

最后找到原因:

改之前

@RequestMapping(value = "/querycustom",method = RequestMethod.POST,produces ={"text/html;charset=UTF-8;", "application/json;"})

@ResponseBody

public Object queryCustomByWhere(

@RequestParam("CUS004") String CUS004,

@RequestParam("industry") String industry,

@RequestParam("salesman") String salesman,

@RequestParam("CUS013") String CUS013,

@RequestParam("CUS009start") String CUS009start,

@RequestParam("CUS009end") String CUS009end,

@RequestParam("CUS011start") String CUS011start,

@RequestParam("CUS011end") String CUS011end

) {

String strWhere = "1=1";

if (!StringUtils.isEmpty(CUS004))

strWhere += " AND CUS004='" + CUS004 + "'";

if (!StringUtils.isEmpty(industry))

strWhere += " AND CUS010='" + industry + "'";

if (!StringUtils.isEmpty(salesman))

strWhere += " AND CUS012='" + salesman + "'";

if (!StringUtils.isEmpty(CUS013))

strWhere += " AND CUS013='" + CUS013 + "'";

if (!StringUtils.isEmpty(CUS009start))

strWhere += " AND CUS009>='" + CUS009start + "'";

if (!StringUtils.isEmpty(CUS009end))

strWhere += " AND CUS009<='" + CUS009end + "'";

if (!StringUtils.isEmpty(CUS011start))

strWhere += " AND CUS011>='" + CUS011start + "'";

if (!StringUtils.isEmpty(CUS011end))

strWhere += " AND CUS011<='" + CUS011end + "'";

ListcustomPage = custemInfoService.findAllByWhere(strWhere);

Mapdatasource=new LinkedHashMap();

datasource.put("code",0);

datasource.put("count",2);

datasource.put("data",customPage);

Gson gson=new Gson();

String result=gson.toJson(datasource);

return result;

}

改之后

@RequestMapping(value = "/querycustom",method = RequestMethod.POST,produces ={"text/html;charset=UTF-8;", "application/json;"})

@ResponseBody

public Object queryCustomByWhere(

@RequestParam("CUS004") String CUS004,

@RequestParam("industry") String industry,

@RequestParam("salesman") String salesman,

@RequestParam("CUS013") String CUS013,

@RequestParam("CUS009start") String CUS009start,

@RequestParam("CUS009end") String CUS009end,

@RequestParam("CUS011start") String CUS011start,

@RequestParam("CUS011end") String CUS011end

) {

String strWhere = "1=1";

if (!StringUtils.isEmpty(CUS004))

strWhere += " AND CUS004='" + CUS004 + "'";

if (!StringUtils.isEmpty(industry))

strWhere += " AND CUS010='" + industry + "'";

if (!StringUtils.isEmpty(salesman))

strWhere += " AND CUS012='" + salesman + "'";

if (!StringUtils.isEmpty(CUS013))

strWhere += " AND CUS013='" + CUS013 + "'";

if (!StringUtils.isEmpty(CUS009start))

strWhere += " AND CUS009>='" + CUS009start + "'";

if (!StringUtils.isEmpty(CUS009end))

strWhere += " AND CUS009<='" + CUS009end + "'";

if (!StringUtils.isEmpty(CUS011start))

strWhere += " AND CUS011>='" + CUS011start + "'";

if (!StringUtils.isEmpty(CUS011end))

strWhere += " AND CUS011<='" + CUS011end + "'";

ListcustomPage = custemInfoService.findAllByWhere(strWhere);

Mapdatasource=new LinkedHashMap();

datasource.put("code",0);

datasource.put("count",2);

datasource.put("data",customPage);

return datasource;

}

本来@ResponseBody代表返回json格式,我又用Gson转了一次,所以有问题。

layui 汉字乱码_layui table中文乱码相关推荐

  1. jmeter对乱码如何处理_JMeter中文乱码的解决

    对于JMeter中文乱码分为两部分: 1.请求(request):由于引用了csv文件当csv文件编码与JMeter不统一可能造成服务器收到数据的中文乱码 2.返回(response):由于服务器返回 ...

  2. 火狐浏览器中文乱码怎么办 Firefox中文乱码解决方法

    核心提示:最近好多网友反映在使用火狐浏览器的时候,网页显示乱码的情况,这种问题通常是由于我们浏览器语言的设置有关系,下面小编就为大家分析下具体的解决办法,希望对大家有所帮助. 火狐浏览器中文乱码怎么办 ...

  3. tomcat8日志乱码_Tomcat日志中文乱码怎么解决?

    Linux系统中文语言乱码,是很多小伙伴在开始接触Linux时经常遇到的问题,而且当我们将已在Wndows部署好的项目搬到Linux上运行时,Tomcat的输出日志中文全为乱码(在Windows上正常 ...

  4. keil5中文乱码,编译中文乱码,串口调试助手接收中文乱码

    keil5中文乱码,编译中文乱码,串口调试助手接收中文乱码 keil5的文本编辑器输入中文乱码 一般更改编码就可以解决 打开设置界面 更改编码,可以是GBK码,也可以是UTF-8编码 编辑器中文没有乱 ...

  5. HTML编程出现乱码,html中文为什么会乱码?html中文乱码怎么解决?

    html中文乱码一般是因为编码格式不匹配.或没有设置编码造成的.解决方法:1.在HTML文件头中使用meta标签把HTML编码方式设置为utf-8:2.使用网页编辑器打开文件,设置统一的编码格式. 很 ...

  6. 为什么html中文是乱码?html中文乱码怎么解决

    很多程序员在开发网站的时候,都会遇到html文件出现乱码,那么,为什么html中文是乱码?html乱码怎么造成的?html中文乱码怎么解决呢,下面php高手为您解决这些问题. 打造全网web前端全栈资 ...

  7. Java解决下载中文乱码和URL中文乱码问题

    解决浏览器下载中文乱码和URL中文乱码问题 下载中文乱码问题 URL路径中含有中文处理方式: 下载中文乱码问题 中文乱码是个让人头痛的问题,这里整理针对下载时,中文乱码问题,下面是Java对应的实现, ...

  8. ssh汉字乱码怎么办_ssh中文乱码怎么办_win10open ssh出现乱码的解决方法

    2019-07-28 14:07:22 有win10正式版系统用户在使用Open ssh客户端的过程中,在切换中文模式的时候出现了乱码的情况,碰到这样的问题该怎么处理呢,现在为大家带来Win10系统O ...

  9. DEV C++光标不在有汉字一行时汉字不显示以及中文乱码问题解决方法

    前言:博主刚开始使用DEV C++时真的是被这两个问题搞得焦头烂额(orz),以至于有中文时都用拼音代替,但是这样程序运行出来后实在是太影响阅读了.于是我上网搜集资料,但网上的资料真的是让人眼花缭乱, ...

  10. ssh汉字乱码怎么办_ssh中文乱码解决

    在终端执行命令: export LC_ALL=zh_CN.GB2312;export LANG=zh_CN.GB2312是最有效的. ======================= 1.不管用那种ss ...

最新文章

  1. 安卓使用Socket发送中文,C语言服务端接收乱码问题解决方式
  2. python表白对话框-python会话框
  3. 已解决:Ubuntu16.4和Windows10创建共享文件夹
  4. 【收藏】Win10自带的邮件客户端配置腾讯企业邮箱账号详解
  5. 解决: VUE 项目中表单提交中文乱码、接口请求参数中文乱码
  6. sql server 面试_SQL Server复制面试问题与解答
  7. oracle 存储过程 发送WebServie 请求
  8. Javascript从零开始学习第一天
  9. PoisonApple:针对macOS的持久化工具
  10. ucGUI3.9版本快速移植构建
  11. vue大屏项目开发框架dataV
  12. 超全总结!一文囊括李航《统计学习方法》几乎所有的知识点!
  13. 命名空间提示“http://schemas.microsoft.com/xaml/behaviors”不存在Interation的解决办法
  14. DHCP实验过程四个阶段
  15. wince 之临时宏控制 bib 和 reg
  16. 天图投资冲刺港股:资产管理规模249亿 投了小红书与奈雪
  17. FPGA三大串行通信接口之UART
  18. 给大学后端小白的一些忠告
  19. 2018 年度读书总结
  20. tarjan BLO

热门文章

  1. n个单词输入次数 c语言,C语言问题,从键盘输入n个英语单词.输入格式为n,w1,w2,w3…wn,其中n表示随后输入的英语...
  2. developer.biao.daily.20140628
  3. cisco设备与基本操作
  4. redis连接异常 redis.clients.jedis.exceptions.JedisClusterException CLUSTERDOWN The cluster is down
  5. 云服务器搭建Java自动化测试框架
  6. 未完成的IT路停在回车键---2014年末总结篇
  7. 卷毛机器人抢大龙_EDG卷毛宣布退役:感谢WE和EDG的培养
  8. List1_Excise
  9. Kubernetes 安全容器技术 kata gvisor
  10. 红蓝对抗---蓝队手册