我碰到一个struts1.2的诡异问题,高手请进来看看
我写了一个输出数据的excel表的程序,执行时应该先执行wb.write(fileOut);然后执行return语句,现在的现象是执行完write之后并没提示保存文件,而是跑去执行return,然后才让我保存文件。。。。
下面为action代码
try {
String SQLStatement =
"select * from t_sap_customer where customer_id = '300314'";
httpServletResponse.reset();
httpServletResponse.setContentType("application/txt; charset=GB2312");
httpServletResponse.setHeader("Content-disposition",
"attachment; filename=customer.xls");
ToExcelHelper excelHelper = new ToExcelHelper();
HSSFWorkbook wb = excelHelper.TransSalaryToExcel(SQLStatement);
ServletOutputStream fileOut = httpServletResponse.getOutputStream();
wb.write(fileOut);
}
catch (Exception e) {
e.printStackTrace();
}
return actionMapping.findForward("Success");
帮帮忙呀