<%@ 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>
利用jsp生成excel格式文件
最新推荐文章于 2025-09-14 14:35:49 发布
本文介绍了一种使用Java和Struts标签库将调查数据导出到Excel文件的方法。通过设置响应头和利用标签库来迭代数据集,可以将包含记录日期、热点类型等字段的数据表格格式化为Excel文档。

801

被折叠的 条评论
为什么被折叠?



