STRUTS+AJAX+JSP 请求到后台乱码问题解决方法

内容摘要
在AJAX请求URL之前 把参数进行encodeURI()转码。

如: 复制代码 代码如下: var fileName=document.getElementById("filePath").value; if(null!=fileName){ //alert(fileName
文章正文
在AJAX请求URL之前 把参数进行encodeURI()转码。

如:
复制代码 代码如下:

var fileName=document.getElementById("filePath").value;
if(null!=fileName){
//alert(fileName);
//进行转码 不然后台会乱码
fileName=encodeURI(fileName);

.........AJAX代码

}

代码注释

作者:喵哥笔记

IDC笔记

学的不仅是技术,更是梦想!