可是页面无法接受我传过去的值啊
su.getRequest.getParameter("xx")
不行,我又该怎么办呢?
su.getRequest.getParameter("xx")
不行,我又该怎么办呢?
解决方案 »
- ibatis是怎样与struts1集成的
- 请教 java HTTP请求问题
- jstl使用相关配置文件
- MyEclipse6.5连接oracle10g出现错误
- JSP中写SQL问题
- 在线等~为什么我的连接池在tomcat5.59下老是包空指针异常
- 这里插入数据 怎么不行啊
- errors.add("username",new ActionMessage("hello.no.username.error")),可如下报错,初学struts,请指教一下,这里的username与什么有关
- 关于CORBA的入门问题
- 请问有关j2ee方面的问题
- *******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);
}
}