Ajax FireFox IE 乱码不兼容
解决方案:
- url中传值,设置Firefox的参数传递编码:url = "tooltipDisplayAction.te?key=" + encodeURIComponent(key); 即是encodeURIComponent
- 在Struts的action中添加接受数据的参数设置:request.setCharacterEncoding("UTF-8");
response.setHeader("Content-Type", "text/html;charset=UTF-8");
String key = request.getParameter("key"); - 如果还不行,就将js,jsp文件的编码改为GBK或者utf-8
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>