java吧 关注:1,240,266贴子:12,712,475
  • 1回复贴,共1

求助为什么java代码在导出数据到execle里面的时候只导出第一...

只看楼主收藏回复

这是主要的2个 代码段
function exportExl()
{
var flag = "${flag}";
var start=document.getElementById("startTime").value;
var end=document.getElementById("endTime").value;
var rankNumber=document.getElementById("rankNumber").value;
document.location.href = 'rank_sellExcelFile.action?rankBean.startTime='+start+"&rankBean.endTime="+end+"&rankBean.rankNumber="+rankNumber+"&flag="+flag;
}
action 代码
public String exportExcelFile() {
PNumExlExport export = new PNumExlExport();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String fileName = "rusult_"+sdf.format(new Date())+".xls";
System.out.println(fileName);
this.response = ServletActionContext.getResponse();
response.reset();
response.setCharacterEncoding("UTF-8");
response.addHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
response.setContentType("application/vnd.ms-excel");
OutputStream os;
try {
os = response.getOutputStream();
if (rankBean==null)
{
export.exportExl(os, rankService,flag);
}
else
{
export.exportExl(os,rankService,rankBean,flag);
}
os.close();
this.response.flushBuffer();
} catch (IOException e) {
e.printStackTrace();
} finally{ }
return null;
}


1楼2013-10-15 08:37回复
    这个类PNumExlExport是自己写的吧,这个方法exportExl又怎么知道它是怎么实现的


    IP属地:浙江2楼2013-10-15 09:34
    回复