想做一个批量下载的功能,可是传中文地址时总是出错,尝试了很多解决方法,最后终于成功了,记录一下。
在第一个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