关于layui姓名查询传值到后台出现乱码问题

只需要加上mothod=‘post’
//表格渲染
   table.render({
     elem: '#test'
     ,height: 600
     ,url: 'studentAction.action?operation=findAllStudent' //数据接口
     ,page: true //开启分页
     ,method:'post'//模糊查询姓名乱码解决
     ,response:{
    	 code:'code',
    	 data:'data'
     }
//    ,toolbar: 'default'//工具条(添加,删除,修改图标)
     ,cols: [[ //表头
    	 { checkbox:true, fixed: 'left',align: 'center',width: '5%' }, 
         { field: 'sid', title: '编号', width: '10%',align: 'center' }, 
         { field: 'sname', title: '姓名', width: '10%' ,align: 'center' }, 
         { field: 'snamePinyin', title: '姓名拼音', width: '15%' ,align: 'center'}, 
         { field: 'age', title: '年龄', width: '10%',align: 'center' }, 
         { field: 'remark', title: '备注', width: '20%',align: 'center' }, 
         { fixed: 'right',title: '操作', width: '30%', align: 'center', toolbar: '#barDemo' }
     ]],
     id: 'testReload'
   });
后台代码
/**
	 * 查询所有和姓名的模糊查询
	 * @param request
	 * @param response
	 * @return
	 */
	public String findAllStudent(HttpServletRequest request, HttpServletResponse response) {
		//分页实例化
		PageBean pageBean = new PageBean();
		pageBean.setRequest(request);

		List<Student> data = studentDao.getStudents(student, pageBean);

		Map<String, Object> map = new HashMap<String, Object>();
		map.put("code", 0);//数据接口状态码问题
		map.put("data", data);
		//jiang map集合转成json格式
		writeTojson(map, response);

		return null;
	}

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值