首页>代码>java servlet页面表格导出Excel(csv格式和xls格式都可以)>/Dom2Table/src/com/zhangjun/edu/exportExcel/DownloadServlet.java
package com.zhangjun.edu.exportExcel;
import java.io.IOException;
import java.util.Date;
import java.util.Hashtable;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.w3c.dom.Document;
/**
* <p>Description:下载生成EXCEL入口</p>
* @author 张军
* @version 1.0
* @date 2012-10-02
*/
@SuppressWarnings("serial")
public class DownloadServlet extends HttpServlet {
@SuppressWarnings("unchecked")
public void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("gbk");
response.setContentType("text/html;charset=gbk");
HttpSession session = request.getSession();
String status = request.getParameter("status");
status = status == null ? "" : status.trim();
Document dom = null;
dom = (Document)session.getAttribute("domList");
session.setAttribute("download",dom);
session.setAttribute("sname","download");
Hashtable hsjxl=new Hashtable();
hsjxl.put("title",new Date().getTime());
session.setAttribute("header",hsjxl);
session.setAttribute("para","header");
response.sendRedirect(request.getContextPath()+"/Dom2Csv");
}
}
最近下载更多
最近浏览更多
cz8857216 LV4
2024年3月8日
fesfefe LV13
2024年1月26日
uni-code_0123 LV1
2023年11月11日
EFWAGGFAWGR
2023年10月19日
暂无贡献等级
微信网友_6467077197238272 LV1
2023年5月8日
lironggang LV38
2023年3月28日
zjc010726
2023年3月15日
暂无贡献等级
qwqw900619 LV4
2022年7月16日
nbzhou2013 LV14
2022年4月4日
一直都会顺利的小吴 LV5
2022年2月16日

