本来是比较简单的东西,但是我的web项目是打包发布的,所以,得不到发布项目的物理路径,只好把生成的 excel生成下载到客户机本地 采用struts结构,在action中取得数据,放入一个vector 中,将此vector置入session里,,jsp代码中生成excel,jsp代码如下:
<%@ page language="java" contentType="text/html;charset=GB2312"%>
<%@ page import="java.io.*"%>
<%@ page import="jxl.Workbook"%>
<%@ page import="jxl.write.*"%>
<%@ page import="jxl.write.WritableWorkbook.*"%>
<%@ page import="jxl.*"%>
<%@ page import="com.agenda.tdyhweb.util.ExcelTools"%>
<%@ page import="java.util.Vector"%>
<%@ page import="java.util.Vector"%>
<%@ page import="com.agenda.tdyhweb.bean.UserInfo"%>
<% response.reset();
response.setHeader("Content-disposition", "attachment;inline;