json中文乱码
摘要:前台无论是请求Servlet还是Action登出json取出数据在页面上显示为乱码需在后台程序中设置响应信息的字符集 JSONArray jsonArray=JSONArray.fromObject(userList); HttpServletResponse response=(HttpServletResponse) ActionContext.getContext().get(ServletActionContext.HTTP_RESPONSE); //必须加上,防止前端从JSON中取出的数据成乱码 response.setCharacterEncoding("UTF-8");
阅读全文
posted @ 2010-11-29 18:31