我的jsp脚本网页,com.fr.base.CodeUtils.cjkDecode(request.getParameter("filename"));语句显示编译 不成功,正确的脚本完整代码如何写,请大神指点,我的代码如下:<%@page language="java" contentType="application/x-msdownload" pageEncoding="gb2312"%><% String filename = com.fr.base.CodeUtils.cjkDecode(request.getParameter("filename")); //获取参数filename,此处 的参数名需要与下面超级链接设置中传递的参数名相同 String GC_name = com.fr.base.CodeUtils.cjkDecode(request.getParameter("GC_name")); String fennei_name = com.fr.base.CodeUtils.cjkDecode(request.getParameter("fennei_name")); response.reset(); response.setContentType("application/x-download"); String downloadfile = "E:/"+GC_name+"/"+fennei_name+"/"+filename; //设置下载文件的路径及名称 response.setHeader("Content-disposition","attachment; filename="+filename); //设置下载文件的名称 java.io.OutputStream outp = null; java.io.FileInputStream in = null; try { outp = response.getOutputStream(); in = new java.io.FileInputStream(downloadfile); byte[] b = new byte[1024]; int i = 0; while((i = in.read(b)) > 0) { outp.write(b, 0, i); } outp.flush(); } catch(Exception e) { System.out.println("Error!"); e.printStackTrace(); } finally { if(in != null) { in.close(); in = null; } if(outp != null) { outp.close(); outp = null; } } %> |
0
|
|