代码如下:
MessageResources message = getResources(request,"FileNameResources");
    String templateFolder = message.getMessage("templateFolder");
    String tempFileName = message.getMessage("YearGradeExportFileName");
   
    String filePath = request.getSession().getServletContext().getRealPath(templateFolder + sep + tempFileName);
    File inFile = new File(filePath);
    
    if (!inFile.exists()) {
        logger.error("file template is not exist!");
        return null;
    }
     
    FileOutputStream fileOut = null;     String outName = StringUtils.getCode() + "." + FileUtils.getFileType(filePath);
    String outFolder = message.getMessage("tempFolder");
    String outPath = request.getSession().getServletContext().getRealPath(outFolder + sep + outName);
   
    POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(filePath));
    HSSFWorkbook wb = new HSSFWorkbook(fs);
    HSSFSheet sheet = wb.getSheetAt(0);
    
  //do search
        int rowNo = 2;
        List<YearGradeExportBean> list = iygs.getYearGradeExportList(ygf.getSchStoreName(), ygf.getSchYear(), 
                                  ygf.getSchBreakRuleTimes(), ygf.getSchLostMark(), ygf.getSchArea(), ygf.getSchFlat());
        
        for (int i=0; i<list.size(); i++) {
         HSSFRow row = sheet.getRow(rowNo);
         YearGradeExportBean bean = list.get(i);
         this.writeRow(row, bean, i);
         rowNo = rowNo+1;
        }
        
        // Write the output to a file
        //FileOutputStream fileOut = new FileOutputStream(outPath);
        fileOut = new FileOutputStream(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"));
            
        }
        else if (tempFileName.endsWith(".pdf")) {
            response.setContentType("application/pdf");
            response.setHeader("Content-disposition", "inline; filename=" + URLEncoder.encode(tempFileName, "UTF-8"));
        }
        else if (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);
        
        File outFile = new File(outPath);
        FileInputStream in = org.apache.commons.io.FileUtils.openInputStream(outFile);
        ServletOutputStream sout = response.getOutputStream();
        int filesize = org.apache.commons.io.IOUtils.copy(in, sout);
        sout.close();
        in.close();
        outFile.delete();
    
        return null;问题是:有左右两个框架L/R,在L中点击一个菜单,R中显示一个List页面,List页面有一个导出按钮。点击后便执行上面的代码,现在已经可以导出了,但是在弹出的文件下载对话框中不管你选择保存还是打开还是取消,List页面的状态总是interactive,不是complete。这个是什么问题?是我漏写了什么语句还是什么原因?请高手指点一下吧