解决ajax回调函数返回的字符串乱码问题


ServletActionContext.getResponse().setContentType("text/json;charset=UTF-8");//解决乱码问题,没有这句,回调函数的内容可能乱码
ServletActionContext.getResponse().getWriter().write("字符串内容");//在写入之前执行上面一句,可以解决乱码
« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3