bootstrap-table 搜索框 中文乱码问题解决

xiaoxiao2021-02-28  56

最近在做web项目时用到了bootstrap-table,在使用搜索框功能时,发现搜索框的searchText参数传递到后台以后,若为中文,则接收到的是乱码,为了解决此问题,我在bootstrap-table的参数实体类:QueryParams.java中,进行了处理:

在searchText属性的set方法中,对编码进行了转换:

/** * 对searchText中文乱码问题进行处理 * @param searchText */ public void setSearchText(String searchText) { try { this.searchText = new String(searchText.getBytes("ISO8859-1"), "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } 问题解决了!

转载请注明原文地址: https://www.6miu.com/read-55540.html

最新回复(0)