jsp导出到Excel
jsp模板文件
<%@ page isELIgnored="false" contentType="application/x-msdownload; charset=GBK"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
<%@ taglib uri="/WEB-INF/sino-tags.tld" prefix="sino"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html-el"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic-el.tld" prefix="logic-el"%> <%
int i = 0;
String tableTitle = "第三方巡查数据导出";
String filename = new String((tableTitle).getBytes("GBK"), "ISO-8859-1") + ".xls";
response.setHeader("Content-Disposition", "attachment;filename=" + filename);
%> <head>
<meta http-equiv="Content-Type"
content="application/x-msexcel;charset=gb2312">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content="Microsoft Excel 11">
<link rel=File-List href="Book1.files/filelist.xml">
<link rel=Edit-Time-Data href="Book1.files/editdata.mso">
<link rel=OLE-Object-Data href="Book1.files/oledata.mso"> <style>
<!--
table {
mso-displayed-decimal-separator: "\.";
mso-displayed-thousand-separator: "\,";
} @page {
margin: 1.0in .75in 1.0in .75in;
mso-header-margin: .5in;
mso-footer-margin: .5in;
} tr {
mso-height-source: auto;
mso-ruby-visibility: none;
} col {
mso-width-source: auto;
mso-ruby-visibility: none;
} br {
mso-data-placement: same-cell;
} .xl29 {
mso-style-parent: style0;
font-size: 17.0pt;
font-weight: 700;
text-align: center;
mso-pattern: auto none;
background: #DDDDDD;
} -->
</style>
<!--[if gte mso 9]><xml>
<x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
<x:Name>Sheet1</x:Name>
<x:WorksheetOptions>
<x:DefaultRowHeight>285</x:DefaultRowHeight>
<x:Selected/>
<x:Panes>
<x:Pane>
<x:Number>3</x:Number>
<x:ActiveRow>10</x:ActiveRow>
<x:ActiveCol>3</x:ActiveCol>
</x:Pane>
</x:Panes>
<x:ProtectContents>False</x:ProtectContents>
<x:ProtectObjects>False</x:ProtectObjects>
<x:ProtectScenarios>False</x:ProtectScenarios>
</x:WorksheetOptions>
</x:ExcelWorksheet>
<x:ExcelWorksheet>
<x:Name>Sheet2</x:Name>
<x:WorksheetOptions>
<x:DefaultRowHeight>285</x:DefaultRowHeight>
<x:ProtectContents>False</x:ProtectContents>
<x:ProtectObjects>False</x:ProtectObjects>
<x:ProtectScenarios>False</x:ProtectScenarios>
</x:WorksheetOptions>
</x:ExcelWorksheet>
<x:ExcelWorksheet>
<x:Name>Sheet3</x:Name>
<x:WorksheetOptions>
<x:DefaultRowHeight>285</x:DefaultRowHeight>
<x:ProtectContents>False</x:ProtectContents>
<x:ProtectObjects>False</x:ProtectObjects>
<x:ProtectScenarios>False</x:ProtectScenarios>
</x:WorksheetOptions>
</x:ExcelWorksheet>
</x:ExcelWorksheets>
<x:WindowHeight>8445</x:WindowHeight>
<x:WindowWidth>11715</x:WindowWidth>
<x:WindowTopX>240</x:WindowTopX>
<x:WindowTopY>15</x:WindowTopY>
<x:ProtectStructure>False</x:ProtectStructure>
<x:ProtectWindows>False</x:ProtectWindows>
</x:ExcelWorkbook>
</xml><![endif]-->
</head>
<body link=blue vlink=purple> <table x:str border=0 cellpadding=0 cellspacing=0 width=551
style='table-layout: fixed; width: 680pt; border: 0px solid #000000;'>
<tr height=19 style='height: 14.25pt;border: 0px;'>
<td align="center" colspan='8' >
<b>第三方巡查数据导出</b>
</td>
</tr>
<tr height=19 style='height: 14.25pt;border: 0px;'>
<td align="left" colspan='8' > </td>
</tr>
<tr height=19 style='height: 14.25pt;border: 0px;'>
<td align="left" colspan='5'> </td>
<td align="left" colspan='3'> </td>
</tr>
</table>
<table x:str border=1 cellpadding=0 cellspacing=0 width=551
style='table-layout: fixed; width: 680pt; border: 1px solid #000000;'>
<col width=30
style='mso-width-source: userset; mso-width-alt: 2784; width: 30pt'>
<col width=30
style='mso-width-source: userset; mso-width-alt: 5120; width: 30pt'>
<col width=30
style='mso-width-source: userset; mso-width-alt: 5120; width: 30pt'>
<col width=150
style='mso-width-source: userset; mso-width-alt: 4000; width: 150pt'>
<col width=30
style='mso-width-source: userset; mso-width-alt: 5728; width: 60pt'>
<col width=60
style='mso-width-source: userset; mso-width-alt: 2784; width: 60pt'>
<col width=300
style='mso-width-source: userset; mso-width-alt: 5120; width: 300pt'>
<tr height=19 style='height: 14.25pt;'>
<td width=30 style='text-align:center'>
序号
</td>
<td width=30 style='text-align:center'>
线路
</td>
<td width=30 style='text-align:center'>
单位工程
</td>
<td width=150 style='text-align:center'>
标题
</td>
<td width=60 style='text-align:center'>
巡查单位
</td>
<td width=60 style='text-align:center'>
巡查时间
</td>
<td width=60 style='text-align:center'>
巡查结果
</td>
<td width=60 style='text-align:center'>
是否预警
</td>
<td width=300 style='text-align:center'>
预警等级
</td>
</tr>
<s:if test="#request.list.size!=0">
<s:iterator value="#request.list" id="obj" status="index" >
<tr height=19 style='height: 14.25pt;'>
<td height="22" align="center" onClick="">
<s:property value='#index.index+1'/>
</td>
<td height="22" align="left">
<s:property value='lineName' />
</td>
<td height="22" align="center">
<s:property value='alias' />
</td>
<td height="22" align="center">
<s:property value='title' />
</td>
<td height="22" align="center">
<s:property value='companyName' />
</td>
<td height="22" align="center">
<s:property value='patrolTimeStr' />
</td>
<td height="22" align="center">
<s:property value='patrolResult' />
</td>
<td height="22" align="center">
<s:property value='isAlarm' />
</td>
<td height="22" align="left" >
<s:property value='warningLevel' />
</td>
</tr>
</s:iterator>
</s:if>
<s:if test="#request.list.size==0">
<tr>
<td colspan="9">未找到任何数据</td>
</tr>
</s:if> </table> </body> </html>
jsp导出到Excel的更多相关文章
- JSP导出Excel后身份证后三位为0
JSP导出Excel身份证号码超出Excel最大限制,用科学计数法表示,但后三位为0,修改方式: <style type="text/css">.txt { ...
- jsp 页面内容导出到Excel中
日常使用网络资源时经常需要把网页中的内容下载到本地,并且导出到Excel中,现在介绍一种非常简单的方式实现网络资源的下载.只需要讲jsp的最上面加上一句话 <% response.reset() ...
- atitit.导出excel的设计----查询结果 导出为excel的实现java .net php 总结
atitit.导出excel的设计----查询结果 导出为excel的实现java .net php 总结 1. 基本的流程 查询获得list 读取jsp的table获得标题and 字段的map to ...
- JAVA实现数据库数据导入/导出到Excel(POI)
准备工作: 1.导入POI包:POI下载地址http://mirrors.tuna.tsinghua.edu.cn/apache/poi/release/src/(重要) 如下 2.导入Java界面美 ...
- MySQL要导出成excel的方法
MySQL 要导出成 excel 文件很简单,执行类似这样的命令: select * from 某个表 into outfile 'd:/文件名.xls'; 上述命令你在服务器上执行,就导在 ...
- ssm框架之将数据库的数据导入导出为excel文件
在这里首先我要将自己遇到的各种问题,以及需求记录下来,做一个备忘,便于以后查看: 需求:主要实现两个功能,将oracle数据库里的数据导出为excel,同时需要将excel表格的数据导入到数据库 环境 ...
- 网站开发进阶(二十五)js如何将html表格导出为excel文件
js如何将html表格导出为excel文件 赠人玫瑰,手留余香.若您感觉此篇博文对您有用,请花费2秒时间点个赞,您的鼓励是我不断前进的动力,共勉! jsp页面数据导出成excel的方法很 ...
- 使用apache的poi来实现数据导出到excel的功能——方式二
此次,介绍利用poi与layui table结合导出excel.这次不需要从数据库中查询出来的数据进行每一行的拼接那么麻烦,我们这次将标题定义一个id值,对应从数据库中查找出来的字段名即可. 1.po ...
- DataTable导出到Excel
简单的导出到Excel中: 代码如下: using System; using System.Collections.Generic; using System.Data; using System. ...
随机推荐
- Android Launcher拖拽事件详解【android4.0--Launcher系列二】
AndroidICS4.0版本的launcher拖 拽的流程,基本和2.3的相似.就是比2.3写的封装的接口多了一些,比如删除类的写法就多了个类.等等.4.0的改变有一些,但是不是特别大.这个月一 直 ...
- Directshow开发播放器相关介绍
原文地址:http://www.cnblogs.com/qiufa/archive/2006/12/19/596949.html DirectShow技术是DirectX推出的建立在DirectDra ...
- JAVA编译器常量
编译器常量的特点就是:它的值在编译期就可以确定.比如: final int i = 5; 再傻的编译器也能在编译时看出它的值是5,不需要到运行时.对于运行时常量,它的值虽然在运行时初始化后不再发生变化 ...
- Redis(十九):Redis压力测试工具benchmark
redis-benchmark使用参数介绍 Redis 自带了一个叫 redis-benchmark 的工具来模拟 N 个客户端同时发出 M 个请求. (类似于 Apache ab 程序).你可以使用 ...
- github上创建ssh连接多个账户
简单的说用两对ssh密钥来连接多个github账户,有的同学问:用一对连接多个账户行吗?答案是不行,因为密钥和你的账户邮箱关联了. 1.生成密钥. sshkey -t rsa -b 4096 -C & ...
- Js动态添加复选框Checkbox
Js动态添加复选框Checkbox的实例方法!!! 首先,使用JS动态产生Checkbox可以采用如下类似的语句: var checkBox=document.createElement(" ...
- 修改JQM的默认配置属性
从本文开始,使用 jQuery Mobile 与 HTML5 开发 Web App 系列将会进入第三部分——jQuery Mobile 事件与方法,这其中将会利用之前所讲述的 jQuery Mobil ...
- Struts2的OGNL遍历数组、List、简单的Map
一.简介 <s:iterator />可以遍历 数据栈里面的任何数组,集合等等 在使用这个标签的时候有三个属性值得我们关注 1. value属性:可选的属性,value属性是指一 ...
- 基于HTML5堆木头游戏
今天要来分享一款很经典的HTML5游戏——堆木头游戏,这款游戏的玩法是将木头堆积起来,多出的部分将被切除,直到下一根木头无法堆放为止.这款HTML5游戏的难点在于待堆放的木头是移动的,因此需要你很好的 ...
- 4种方法让SpringMVC接收多个对象 <转>
问题背景: 我要在一个表单里同时一次性提交多名乘客的个人信息到SpringMVC,前端HTML和SpringMVC Controller里该如何处理? 第1种方法:表单提交,以字段数组接收: 第2种方 ...