利用jsp生成excel格式文件

来源:互联网 发布:人工智能芯片股票 编辑:程序博客网 时间:2024/04/28 02:40
 
<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%><%@ taglib prefix="s" uri="/struts-tags" %><%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><%@ taglib uri="/WEB-INF/tlds/test.tld" prefix="pig"%><%@ page language="java" import="org.etone.fs.market.bean.movie.*"%><%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">  <html>      <head>              <title>Excel文档</title>              </head>      <meta http-equiv=Content-Type content="text/html; charset=GB2312">      <meta name=ProgId content=Excel.Sheet>      <meta name=Generator content="Microsoft Excel 9">      <meta http-equiv=Content-Type content="text/html; charset=GB2312">      <%response.setHeader("Content-disposition","attachment;filename=surveywlan_exportData.xls");%>      <body>           <table id="list" width="100%" cellpadding="0" cellspacing="1" class="dg_borderstyle" border="1">                     <tr>               <th width="10%" style="background-color:#9FBFE3"><div align="center">记录日期</div></th>                <th width="10%" style="background-color:#9FBFE3"><div align="center">热点类型</div></th>               <th width="13%" style="background-color:#9FBFE3"><div align="center">上网类型</div></th>                <th width="12%" style="background-color:#9FBFE3"><div align="center">手机号码</div></th>                <th width="12%" style="background-color:#9FBFE3"><div align="center">地址建议</div></th>                              </tr>           <s:iterator value="exportSurveyList" id="dto" status="sta">                      <tr  onMouseOver="MOver(this)" onMouseOut="Mout(this)" class="dg_alternatingitemstyle">                                                <td align="center" class="f">                        ${dto.recmakedate}                        </td>                        <td align="center" class="f">                        ${dto.type}                        </td>                        <td align="center" class="f">                        ${dto.onlinetype}                        </td>                        <td align="center" class="f">                        ${dto.mobileno}                        </td>                        <td align="center" class="f">                        ${dto.address}                        </td>                        </tr>                    </s:iterator>      </table>      </body>    </html>   

原创粉丝点击