根据模版导出excel!求大神

时间:2022-07-29 20:34:20
如题:根据模版导出excel。
excel名:getMoneySample.xls
序号 银行 地区(省) 地区(市/区) 支行名 开户名 卡号  金额  电话号码 备注



都是单个单元格。求教,菜鸟不会啊~

13 个解决方案

#1


你是什么数据库,写出查询语句,得到对应列的 查询视图,然后如果用了navicat ,直接导出就是,其他sql工具也可以导出的

#2


引用 1 楼 shijing266 的回复:
你是什么数据库,写出查询语句,得到对应列的 查询视图,然后如果用了navicat ,直接导出就是,其他sql工具也可以导出的

是从数据库里面取值,java里面的excel模版导出。网上说的是jxl.jar包,但是具体不太会

#3


没那么麻烦的,java POI就可以处理的

参考

#4


引用 3 楼 shijing266 的回复:
没那么麻烦的,java POI就可以处理的

参考

谢谢!我试了下,其他都ok。但是呢这里面的做法是直接指定路径:
FileOutputStream fout = new FileOutputStream("E:/students.xls");  

我想是通过浏览器的下载,下载到到download,该怎么修改。
非常感谢!

#5


参考下哦,另外,你可以找下java  excel模板下载

#6


使用jxls ,注意不是 jxl!
http://blog.csdn.net/geloin/article/details/17242523
通过这个你可以很快利用模版直接生成你想要的数据文件。

 Map<String, List<Report>> beanParams = new HashMap<String, List<Report>>();  
        beanParams.put("reports", reports);  
        XLSTransformer former = new XLSTransformer();  
        former.transformXLS(tplPath, beanParams, destPath); 

#7


public String excel()throws Exception{
 ExcelUtil excel=new ExcelUtil();  
    List<Object> list = userService.findByTime(beginTime, endTime);
    String[] Title={"id","会员编号","会员编号(CN)","积分","姓名","身份证号","手机号","备注","状态"};  
    excel.exportExcel("会员信息.xls",Title, list);  
    return null;  
}

#8



 public  final static String exportExcel(List<UserVo> userList) {  
 try {
            WritableWorkbook wwb = null;
             
               // 创建可写入的Excel工作簿
               String fileName = "C://会员信息.xls";
               File file=new File(fileName);
               if (!file.exists()) {
                   file.createNewFile();
               }
               //以fileName为文件名来创建一个Workbook
               wwb = Workbook.createWorkbook(file);

               // 创建工作表
               WritableSheet ws = wwb.createSheet("会员信息", 0);
               //查询数据库中所有的数据
               List<UserVo> list= userList;
               //要插入到的Excel表格的行号,默认从0开始
               Label labelid= new Label(0, 0, "id");//表示第
               Label labeluserNo= new Label(1, 0, "会员编号");
               Label labeltotalPoints= new Label(2, 0, "积分");
               Label labeluserName= new Label(3, 0, "姓名");
               Label labelidcard= new Label(4, 0, "身份证号");
               Label labelphone= new Label(5, 0, "手机号");
         
               ws.addCell(labelid);
                   ws.addCell(labeluserNo);
                   ws.addCell(labeltotalPoints);
                   ws.addCell(labeluserName);
                   ws.addCell(labelidcard);
                   ws.addCell(labelphone);
                
               for (int i = 0; i < list.size(); i++) {
                   Label id= new Label(0, i+1, list.get(i).getId()+"");
                   Label userNo= new Label(1, i+1, list.get(i).getUserNo());
                   Label totalPoints= new Label(2, i+1, list.get(i).getTotalPoints()+"");
                   Label userName= new Label(3, i+1, list.get(i).getRealName());
                   Label idcard = new Label(4, i+1, list.get(i).getIdCard());
                   Label phone= new Label(5, i+1, list.get(i).getPhone());
              
                   ws.addCell(id);
                   ws.addCell(userNo);
                   ws.addCell(totalPoints);
                   ws.addCell(userName);
                   ws.addCell(idcard);
                   ws.addCell(phone);
            
               }
             
              //写进文档
               wwb.write();
              // 关闭Excel工作簿对象
               wwb.close();
             
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } 
        return null;

#9


引用 4 楼 u013155088 的回复:
Quote: 引用 3 楼 shijing266 的回复:

没那么麻烦的,java POI就可以处理的

参考

谢谢!我试了下,其他都ok。但是呢这里面的做法是直接指定路径:
FileOutputStream fout = new FileOutputStream("E:/students.xls");  

我想是通过浏览器的下载,下载到到download,该怎么修改。
非常感谢!


可以先生成该excel文件,然后再提供下载!

#10


昨天可以通过download下载excel了,但是后台报了一个错,却不影响生成excel。有解决办法没,网上找的都不行~啊@执笔记忆的空白 
下面贴代码

#11


@SuppressWarnings({ "deprecation", "rawtypes", "unused", "resource" })
public String getExcelByBoiler(List list) {  
  
try {
ActionContext ac = ActionContext.getContext();
HttpServletRequest request = (HttpServletRequest)ac.get(ServletActionContext.HTTP_REQUEST);
HttpServletResponse response = (HttpServletResponse)ac.get(ServletActionContext.HTTP_RESPONSE);
String templetPath = System.getProperty("veivo.root") + "temp" + File.separatorChar + "getMoneySample.xls";
        File file = new File(templetPath);
        FileInputStream fis = new FileInputStream(file);
        HSSFWorkbook wb = new HSSFWorkbook(fis);
        HSSFSheet sheet = wb.getSheetAt(0);
        
        HSSFRow row = sheet.getRow((int) 0);
        // 第五步,写入实体数据 实际应用中这些数据从数据库得到
//        String[] strs=super.ids;
//  @SuppressWarnings("rawtypes")
// List list = new ArrayList();  
// for(String uuid:strs){
// applyGetmoney=applyGetmoneyService.get(uuid);
// list.add(applyGetmoney);
// }
        for (int i = 0; i < list.size(); i++){
         row = sheet.createRow((int) i + 1);
         ApplyGetmoney apply = (ApplyGetmoney) list.get(i);
         row.createCell((short) 0).setCellValue(i+1);
row.createCell((short) 1).setCellValue(apply.getBankUuid().getBankName());//银行
row.createCell((short) 2).setCellValue("");//地区(省)
row.createCell((short) 3).setCellValue("");//地区(市/区)
row.createCell((short) 4).setCellValue(apply.getBankUuid().getBankName());//支行名
row.createCell((short) 5).setCellValue(apply.getBankUserName());//开户名
row.createCell((short) 6).setCellValue(apply.getBankCardno());//卡号
row.createCell((short) 7).setCellValue(apply.getApplyMoney().toString());//金额
row.createCell((short) 8).setCellValue(apply.getApplyUserid().getUserTel());//电话号码
row.createCell((short) 9).setCellValue(apply.getMemo());//备注
        }
// 这里面的行和列的数法与计算机里的一样,从0开始是第一  
// 填充title数据  
/****************************输出流*****************************************/  
String address = DateUtil.getCurrentDate();
OutputStream os = ((ServletResponse) response).getOutputStream();// 取得输出流  
((ServletResponse) response).setContentType("application/vnd.ms-excel");  
((HttpServletResponse) response).setHeader("Content-disposition",  
"attachment;filename=getMoneySample"+".xls");  
wb.write(os);  
os.close();
} catch (FileNotFoundException e) {
System.out.println("文件路径错误");  
e.printStackTrace();  
} catch (IOException e) {
System.out.println("文件输入流错误");  
e.printStackTrace();  
}  
return null;  
}  
}
这是代码,下面是错误信息

#12


java.lang.IllegalStateException: getOutputStream() has already been called for this response
at org.apache.catalina.connector.Response.getWriter(Response.java:611)
at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:198)
at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:112)
at org.apache.struts2.views.freemarker.FreemarkerResult.getWriter(FreemarkerResult.java:271)
at org.apache.struts2.views.freemarker.FreemarkerResult.doExecute(FreemarkerResult.java:188)
at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:191)
at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:369)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:273)
at com.mbpsoft.base.extend.struts.OptimisticLockInterceptor.intercept(OptimisticLockInterceptor.java:69)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)
at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:76)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:229)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:229)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:139)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at org.springframework.base.interceptor.TrimInterceptor.intercept(TrimInterceptor.java:38)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:253)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.mbpsoft.base.extend.struts.LogInterceptor.intercept(LogInterceptor.java:56)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.mbpsoft.base.extend.struts.GlobalExceptionInterceptor.intercept(GlobalExceptionInterceptor.java:28)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:564)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:81)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:119)

#13


getOutputStream() has already been called for this response

意思就是你已经通过response进行了回调输出流了,你的代码wb.write(os); 也输出了一次

#1


你是什么数据库,写出查询语句,得到对应列的 查询视图,然后如果用了navicat ,直接导出就是,其他sql工具也可以导出的

#2


引用 1 楼 shijing266 的回复:
你是什么数据库,写出查询语句,得到对应列的 查询视图,然后如果用了navicat ,直接导出就是,其他sql工具也可以导出的

是从数据库里面取值,java里面的excel模版导出。网上说的是jxl.jar包,但是具体不太会

#3


没那么麻烦的,java POI就可以处理的

参考

#4


引用 3 楼 shijing266 的回复:
没那么麻烦的,java POI就可以处理的

参考

谢谢!我试了下,其他都ok。但是呢这里面的做法是直接指定路径:
FileOutputStream fout = new FileOutputStream("E:/students.xls");  

我想是通过浏览器的下载,下载到到download,该怎么修改。
非常感谢!

#5


参考下哦,另外,你可以找下java  excel模板下载

#6


使用jxls ,注意不是 jxl!
http://blog.csdn.net/geloin/article/details/17242523
通过这个你可以很快利用模版直接生成你想要的数据文件。

 Map<String, List<Report>> beanParams = new HashMap<String, List<Report>>();  
        beanParams.put("reports", reports);  
        XLSTransformer former = new XLSTransformer();  
        former.transformXLS(tplPath, beanParams, destPath); 

#7


public String excel()throws Exception{
 ExcelUtil excel=new ExcelUtil();  
    List<Object> list = userService.findByTime(beginTime, endTime);
    String[] Title={"id","会员编号","会员编号(CN)","积分","姓名","身份证号","手机号","备注","状态"};  
    excel.exportExcel("会员信息.xls",Title, list);  
    return null;  
}

#8



 public  final static String exportExcel(List<UserVo> userList) {  
 try {
            WritableWorkbook wwb = null;
             
               // 创建可写入的Excel工作簿
               String fileName = "C://会员信息.xls";
               File file=new File(fileName);
               if (!file.exists()) {
                   file.createNewFile();
               }
               //以fileName为文件名来创建一个Workbook
               wwb = Workbook.createWorkbook(file);

               // 创建工作表
               WritableSheet ws = wwb.createSheet("会员信息", 0);
               //查询数据库中所有的数据
               List<UserVo> list= userList;
               //要插入到的Excel表格的行号,默认从0开始
               Label labelid= new Label(0, 0, "id");//表示第
               Label labeluserNo= new Label(1, 0, "会员编号");
               Label labeltotalPoints= new Label(2, 0, "积分");
               Label labeluserName= new Label(3, 0, "姓名");
               Label labelidcard= new Label(4, 0, "身份证号");
               Label labelphone= new Label(5, 0, "手机号");
         
               ws.addCell(labelid);
                   ws.addCell(labeluserNo);
                   ws.addCell(labeltotalPoints);
                   ws.addCell(labeluserName);
                   ws.addCell(labelidcard);
                   ws.addCell(labelphone);
                
               for (int i = 0; i < list.size(); i++) {
                   Label id= new Label(0, i+1, list.get(i).getId()+"");
                   Label userNo= new Label(1, i+1, list.get(i).getUserNo());
                   Label totalPoints= new Label(2, i+1, list.get(i).getTotalPoints()+"");
                   Label userName= new Label(3, i+1, list.get(i).getRealName());
                   Label idcard = new Label(4, i+1, list.get(i).getIdCard());
                   Label phone= new Label(5, i+1, list.get(i).getPhone());
              
                   ws.addCell(id);
                   ws.addCell(userNo);
                   ws.addCell(totalPoints);
                   ws.addCell(userName);
                   ws.addCell(idcard);
                   ws.addCell(phone);
            
               }
             
              //写进文档
               wwb.write();
              // 关闭Excel工作簿对象
               wwb.close();
             
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } 
        return null;

#9


引用 4 楼 u013155088 的回复:
Quote: 引用 3 楼 shijing266 的回复:

没那么麻烦的,java POI就可以处理的

参考

谢谢!我试了下,其他都ok。但是呢这里面的做法是直接指定路径:
FileOutputStream fout = new FileOutputStream("E:/students.xls");  

我想是通过浏览器的下载,下载到到download,该怎么修改。
非常感谢!


可以先生成该excel文件,然后再提供下载!

#10


昨天可以通过download下载excel了,但是后台报了一个错,却不影响生成excel。有解决办法没,网上找的都不行~啊@执笔记忆的空白 
下面贴代码

#11


@SuppressWarnings({ "deprecation", "rawtypes", "unused", "resource" })
public String getExcelByBoiler(List list) {  
  
try {
ActionContext ac = ActionContext.getContext();
HttpServletRequest request = (HttpServletRequest)ac.get(ServletActionContext.HTTP_REQUEST);
HttpServletResponse response = (HttpServletResponse)ac.get(ServletActionContext.HTTP_RESPONSE);
String templetPath = System.getProperty("veivo.root") + "temp" + File.separatorChar + "getMoneySample.xls";
        File file = new File(templetPath);
        FileInputStream fis = new FileInputStream(file);
        HSSFWorkbook wb = new HSSFWorkbook(fis);
        HSSFSheet sheet = wb.getSheetAt(0);
        
        HSSFRow row = sheet.getRow((int) 0);
        // 第五步,写入实体数据 实际应用中这些数据从数据库得到
//        String[] strs=super.ids;
//  @SuppressWarnings("rawtypes")
// List list = new ArrayList();  
// for(String uuid:strs){
// applyGetmoney=applyGetmoneyService.get(uuid);
// list.add(applyGetmoney);
// }
        for (int i = 0; i < list.size(); i++){
         row = sheet.createRow((int) i + 1);
         ApplyGetmoney apply = (ApplyGetmoney) list.get(i);
         row.createCell((short) 0).setCellValue(i+1);
row.createCell((short) 1).setCellValue(apply.getBankUuid().getBankName());//银行
row.createCell((short) 2).setCellValue("");//地区(省)
row.createCell((short) 3).setCellValue("");//地区(市/区)
row.createCell((short) 4).setCellValue(apply.getBankUuid().getBankName());//支行名
row.createCell((short) 5).setCellValue(apply.getBankUserName());//开户名
row.createCell((short) 6).setCellValue(apply.getBankCardno());//卡号
row.createCell((short) 7).setCellValue(apply.getApplyMoney().toString());//金额
row.createCell((short) 8).setCellValue(apply.getApplyUserid().getUserTel());//电话号码
row.createCell((short) 9).setCellValue(apply.getMemo());//备注
        }
// 这里面的行和列的数法与计算机里的一样,从0开始是第一  
// 填充title数据  
/****************************输出流*****************************************/  
String address = DateUtil.getCurrentDate();
OutputStream os = ((ServletResponse) response).getOutputStream();// 取得输出流  
((ServletResponse) response).setContentType("application/vnd.ms-excel");  
((HttpServletResponse) response).setHeader("Content-disposition",  
"attachment;filename=getMoneySample"+".xls");  
wb.write(os);  
os.close();
} catch (FileNotFoundException e) {
System.out.println("文件路径错误");  
e.printStackTrace();  
} catch (IOException e) {
System.out.println("文件输入流错误");  
e.printStackTrace();  
}  
return null;  
}  
}
这是代码,下面是错误信息

#12


java.lang.IllegalStateException: getOutputStream() has already been called for this response
at org.apache.catalina.connector.Response.getWriter(Response.java:611)
at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:198)
at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:112)
at org.apache.struts2.views.freemarker.FreemarkerResult.getWriter(FreemarkerResult.java:271)
at org.apache.struts2.views.freemarker.FreemarkerResult.doExecute(FreemarkerResult.java:188)
at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:191)
at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:369)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:273)
at com.mbpsoft.base.extend.struts.OptimisticLockInterceptor.intercept(OptimisticLockInterceptor.java:69)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)
at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:76)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:229)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:229)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:139)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at org.springframework.base.interceptor.TrimInterceptor.intercept(TrimInterceptor.java:38)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:253)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.mbpsoft.base.extend.struts.LogInterceptor.intercept(LogInterceptor.java:56)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at com.mbpsoft.base.extend.struts.GlobalExceptionInterceptor.intercept(GlobalExceptionInterceptor.java:28)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:564)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:81)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:119)

#13


getOutputStream() has already been called for this response

意思就是你已经通过response进行了回调输出流了,你的代码wb.write(os); 也输出了一次