想做一個批量下載的功能,可是傳中文地址時總是出錯,嘗試了很多解決方法,最後終於成功了,記錄一下。
在第一個action中將filePath編碼
filePath=URLEncoder.encode (filePath,"UTF-8");
String nextUrl = "/hep/do/paperUser?action=down&filePath="+filePath;
response.sendRedirect(nextUrl);
在另一個action中解碼
filePath=URLDecoder.decode (filePath,"UTF-8");
在做jsp頁面時由於加了一個
<input type="hidden" id="submit " name="submit " value="N" />
然後js中的document.form1.submit();這句話就無效了。
原來id和name不能爲submit