可是页面无法接受我传过去的值啊
su.getRequest.getParameter("xx")
不行,我又该怎么办呢?
su.getRequest.getParameter("xx")
不行,我又该怎么办呢?
解决方案 »
- hibernate的简单问题,也许很幼稚
- 如何处理struts2 file标签的格式问题
- stuts2 拦截器问题,怎么办啊?高手们,项目急等
- SOS~大家帮我看看我这么写简历能找到工作吗???
- 甚急,sybase表没有主键时,java查询表抛出异常怎么设置解决?
- ant,rebuild all的問題,來者有分,散分
- executeBatch时 如何得到是哪些语句出错呢
- 在struts中,action相当于一个servlet?
- 请问各位 ,能否帮助参谋参谋 ,作java的,作企业应用有前途还是作在线游戏有前途呢?
- 应用服务器与WEB SERVER的区别
- *******100求救,如何自底向上生成远程接口的cmp Etitity Bean?**********************
- 一个TOMCAT的简单问题!谢谢来指点
* 文件下载
* @param request
* @param response
* @throws IOException
* @throws ServletException
*/ protected void updateDownload(HttpServletRequest request,
HttpServletResponse response) throws
IOException, ServletException {
try {
int num = 0;
String postfix = "";
String errMsg = "";
String linkStr = "";
String filePath1 = "";
ExtendString T = new ExtendString();
String flag = request.getParameter("flag");
String filePath = request.getParameter("filePath");
String fileName = request.getParameter("fileName");
filePath1 = T.CS(filePath); //处理文件名
num = filePath.lastIndexOf(".");
postfix = filePath.substring(num);
fileName = fileName + postfix; //下载文件
response.reset();
response.setContentType("bin");
response.setHeader("Content-Disposition",
"attachment; filename=\"" + fileName +
"\""); ServletOutputStream out = response.getOutputStream();
java.io.File ffile = new java.io.File(request.getRealPath(filePath1));
if (!ffile.exists()) {
errMsg = URLEncoder.encode("系统找不到该文件!", "GBK");
linkStr = "/error/Error.jsp?errMsg=" + errMsg;
this.forward(linkStr, request, response);
return;
} InputStream inStream = new FileInputStream(ffile); //循环取出流中的数据
byte[] b = new byte[1024];
int len;
while ( (len = inStream.read(b)) > 0) {
out.write(b, 0, len);
}
out.close();
inStream.close();
}
catch (Exception ex) {
ex.printStackTrace();
this.exceptionError(request, response);
}
}