zoukankan      html  css  js  c++  java
  • EL表达式查询出来的数据,下载成excel表格,很实用的

    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <%@ page contentType="application/vnd.ms-excel; charset=gbk" %>
    <%@page import="java.text.SimpleDateFormat"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    SimpleDateFormat sf = new SimpleDateFormat("yyyyMMddkkmmssSSS");
    String filename = new String(("文件名字-"+sf.format(new Date())).getBytes("gbk"),"ISO-8859-1");
    response.addHeader("Content-Disposition", "filename=" + filename + ".xls");
    %>
    <%@ page isELIgnored="false"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <base href="<%=basePath%>">

    <title>XX信息</title>
    <link href="<%=basePath%>pages/packageInfo/css/table.css" rel="stylesheet" type="text/css" />

    </head>

    <body>
    <div class="boderBG">
    <table id="hacker" width="98%" border="0" cellspacing="1" cellpadding="0" class="dataTable">
    <thead><tr>
    <th width="11%" height="23" align="center">XX</th>
    <th width="11%" align="center">XX</th>
    <th width="10%" align="center">XX</th>
    <th width="11%" align="center">XX</th>
    <th width="11%" align="center">XX</th>
    <th width="11%" align="center">XX</th>
    <th width="11%" align="center">XX</th>
    <th width="11%" align="center">XX</th>
    <th width="11%" align="center">XX</th>
    </tr>
    </thead>
    <c:forEach var="calRecordList" items="${calRecordList}" >
    <tr>
    <td height="23" >${calRecordList.callnum}</td>
    <td >${calRecordList.toCallnum}</td>
    <td><fmt:formatDate value="${calRecordList.begintime}" pattern="yyyy年MM月dd HH:mm:ss" /></td>
    <td align="center"><fmt:formatDate value="${calRecordList.endtime}" pattern="yyyy年MM月dd HH:mm:ss" /></td>
    <td align="center">${calRecordList.calltype}</td>
    <td align="center">${calRecordList.talktime}</td>
    <td align="center">${calRecordList.billtime}</td>
    <td align="center">${calRecordList.fee}</td>
    <td align="center">${calRecordList.groupid}</td>
    </tr>
    </c:forEach>
    </table>
    </div>
    </body>
    </html>

  • 相关阅读:
    day 66 ORM django 简介
    day 65 HTTP协议 Web框架的原理 服务器程序和应用程序
    jQuery的事件绑定和解绑 事件委托 轮播实现 jQuery的ajax jQuery补充
    background 超链接导航栏案例 定位
    继承性和层叠性 权重 盒模型 padding(内边距) border(边框) margin 标准文档流 块级元素和行内元素
    属性选择器 伪类选择器 伪元素选择器 浮动
    css的导入方式 基础选择器 高级选择器
    03-body标签中相关标签
    Java使用内存映射实现大文件的上传
    正则表达式
  • 原文地址:https://www.cnblogs.com/zhangliang88/p/5470515.html
Copyright © 2011-2022 走看看