STRUTS+AJAX+JSP 請求到后臺亂碼問題解決方法
更新時間:2013年12月24日 16:12:22 作者:
STRUTS+AJAX+JSP 請求到后臺亂碼問題可在AJAX請求URL之前把參數進行encodeURI()轉碼來解決,遇到類似情況的朋友可以參考下
在AJAX請求URL之前 把參數進行encodeURI()轉碼。
如:
var fileName=document.getElementById("filePath").value;
if(null!=fileName){
//alert(fileName);
//進行轉碼 不然后臺會亂碼
fileName=encodeURI(fileName);
.........AJAX代碼
}
如:
復制代碼 代碼如下:
var fileName=document.getElementById("filePath").value;
if(null!=fileName){
//alert(fileName);
//進行轉碼 不然后臺會亂碼
fileName=encodeURI(fileName);
.........AJAX代碼
}

