STRUTS+AJAX+JSP 請求到后臺亂碼問題解決方法
來源:懂視網
責編:小采
時間:2020-11-27 22:52:16
STRUTS+AJAX+JSP 請求到后臺亂碼問題解決方法
STRUTS+AJAX+JSP 請求到后臺亂碼問題解決方法:在AJAX請求URL之前 把參數進行encodeURI()轉碼。 如: 代碼如下:var fileName=document.getElementById(filePath).value; if(null!=fileName){ //alert(fileName); //進行轉碼 不然后臺會亂碼 fileName=encodeUR
導讀STRUTS+AJAX+JSP 請求到后臺亂碼問題解決方法:在AJAX請求URL之前 把參數進行encodeURI()轉碼。 如: 代碼如下:var fileName=document.getElementById(filePath).value; if(null!=fileName){ //alert(fileName); //進行轉碼 不然后臺會亂碼 fileName=encodeUR

在AJAX請求URL之前 把參數進行encodeURI()轉碼。
如:
代碼如下:
var fileName=document.getElementById("filePath").value;
if(null!=fileName){
//alert(fileName);
//進行轉碼 不然后臺會亂碼
fileName=encodeURI(fileName); .........AJAX代碼
}
聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com
STRUTS+AJAX+JSP 請求到后臺亂碼問題解決方法
STRUTS+AJAX+JSP 請求到后臺亂碼問題解決方法:在AJAX請求URL之前 把參數進行encodeURI()轉碼。 如: 代碼如下:var fileName=document.getElementById(filePath).value; if(null!=fileName){ //alert(fileName); //進行轉碼 不然后臺會亂碼 fileName=encodeUR