问题描述
代码如下:MessageResourcesmessage=getResources(request,"FileNameResources");StringtemplateFolder=message.getMessage("templateFolder");StringtempFileName=message.getMessage("YearGradeExportFileName");StringfilePath=request.getSession().getServletContext().getRealPath(templateFolder+sep+tempFileName);FileinFile=newFile(filePath);if(!inFile.exists()){logger.error("filetemplateisnotexist!");returnnull;}FileOutputStreamfileOut=null;StringoutName=StringUtils.getCode()+"."+FileUtils.getFileType(filePath);StringoutFolder=message.getMessage("tempFolder");StringoutPath=request.getSession().getServletContext().getRealPath(outFolder+sep+outName);POIFSFileSystemfs=newPOIFSFileSystem(newFileInputStream(filePath));HSSFWorkbookwb=newHSSFWorkbook(fs);HSSFSheetsheet=wb.getSheetAt(0);//dosearchintrowNo=2;List<YearGradeExportBean>list=iygs.getYearGradeExportList(ygf.getSchStoreName(),ygf.getSchYear(),ygf.getSchBreakRuleTimes(),ygf.getSchLostMark(),ygf.getSchArea(),ygf.getSchFlat());for(inti=0;i<list.size();i++){HSSFRowrow=sheet.getRow(rowNo);YearGradeExportBeanbean=list.get(i);this.writeRow(row,bean,i);rowNo=rowNo+1;}//Writetheoutputtoafile//FileOutputStreamfileOut=newFileOutputStream(outPath);fileOut=newFileOutputStream(outPath);wb.write(fileOut);fileOut.close();//setResponseHead(response,tempFileName);if(tempFileName.endsWith(".doc")||tempFileName.endsWith(".rtf")){response.setContentType("application/msword");response.setHeader("Content-disposition","inline;filename="+URLEncoder.encode(tempFileName,"UTF-8"));}elseif(tempFileName.endsWith(".pdf")){response.setContentType("application/pdf");response.setHeader("Content-disposition","inline;filename="+URLEncoder.encode(tempFileName,"UTF-8"));}elseif(tempFileName.endsWith(".xls")){response.setContentType("application/vnd.ms-excel");response.setHeader("Content-disposition","inline;filename="+URLEncoder.encode(tempFileName,"UTF-8"));}else{response.setContentType("application/x-msdownload");response.setHeader("Content-disposition","attachment;filename="+URLEncoder.encode(tempFileName,"UTF-8"));}//outputFile(response,outPath);FileoutFile=newFile(outPath);FileInputStreamin=org.apache.commons.io.FileUtils.openInputStream(outFile);ServletOutputStreamsout=response.getOutputStream();intfilesize=org.apache.commons.io.IOUtils.copy(in,sout);sout.close();in.close();outFile.delete();returnnull;问题是:有左右两个框架L/R,在L中点击一个菜单,R中显示一个List页面,List页面有一个导出按钮。点击后便执行上面的代码,现在已经可以导出了,但是在弹出的文件下载对话框中不管你选择保存还是打开还是取消,List页面的状态总是interactive,不是complete。这个是什么问题?是我漏写了什么语句还是什么原因?请高手指点一下吧
解决方案
解决方案二:
该回复于2010-05-18 16:20:17被版主删除
解决方案三:
引用1楼ivy999的回复:
友情支持!up……
+1