jxl导出excel,通常浏览器会提示excel导出完成情况及默认保存路径,或让用户自定义选择保存路径,要达到这种效果,有些要做下修改,如:response是jsp的内置对象,在jsp中使用时不用声明,但用在action中需要声明。
代码如下:HttpServletResponse response = ServletActionContext.getResponse();response.reset();response.setContentType("application/vnd.ms-excel");response.setHeader("Content-dposition:on","attachment;filename=log");OutputStream os=response.getOutputStream(); jxl.write.WritableWorkbook wwb = Workbook.createWorkbook(os);...此处省略