鍍金池/ 問答/HTML/ bootStrap-table這個(gè)插件加載從服務(wù)器返回的數(shù)據(jù)中文會(huì)亂碼

bootStrap-table這個(gè)插件加載從服務(wù)器返回的數(shù)據(jù)中文會(huì)亂碼

bootStrap-table加載從服務(wù)器返回的數(shù)據(jù),中文會(huì)亂碼?
這是表格初始化的代碼
clipboard.png
**
clipboard.png
**
其實(shí)上面都沒有疑問都是對(duì)的!

動(dòng)態(tài)創(chuàng)建列代碼

clipboard.png

請(qǐng)求后臺(tái)數(shù)據(jù)也是中文的

clipboard.png

到了前端

clipboard.png

這是返回的javaBean

public class VideoChildTableModel {

private String id;

private String name;

private double length;

private int status;

@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date uploadDate;

public String getId() {
    return id;
}

public void setId(String id) {
    this.id = id;
}

public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

public double getLength() {
    return length;
}

public void setLength(double length) {
    this.length = length;
}

public int getStatus() {
    return status;
}

public void setStatus(int status) {
    this.status = status;
}

public Date getUploadDate() {
    return uploadDate;
}

public void setUploadDate(Date uploadDate) {
    this.uploadDate = uploadDate;
}

public VideoChildTableModel(String id, String name, double length, int status, Date uploadDate) {
    super();
    this.id = id;
    this.name = name;
    this.length = length;
    this.status = status;
    this.uploadDate = uploadDate;
}

public VideoChildTableModel() {
    super();
    // TODO Auto-generated constructor stub
}

}
html的頭部也是utf-8

clipboard.png

然后我自己請(qǐng)求了一下后臺(tái)數(shù)據(jù)

clipboard.png

然后自己又寫了個(gè)ajax請(qǐng)求實(shí)驗(yàn)

clipboard.png

clipboard.png

這個(gè)真的不知道是哪兒的問題亂了!只能是這個(gè)插件的問題了!我覺得有沒有大佬在用的時(shí)候遇到過這個(gè)問題!前端真的頭痛!

回答
編輯回答
祉小皓

哥們這個(gè)問題解決沒

2017年3月11日 18:49
編輯回答
伐木累

嘗試下下面的幾種方案:
1.引中文包
<script type="text/javascript" src="<%=contextPath%>/scripts/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
2.在前端加上下面的內(nèi)容
<html lang="zh_CN">

<meta charset="UTF-8">

3.在后端代碼以流的形式返回到前端
OutputStream out = response.getOutputStream();
out.write(json.toString().getBytes("UTF-8"));
out.flush();
out.close();

2018年5月23日 12:47