• JSP生成Excel报表


      JSP实现报表下载

    <%@ page contentType="text/html; charset=UTF-8" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <% response.setContentType("application/vnd.ms-excel;charset=UTF-8"); %>
    <!-- 设置下载文件的文件名 -->
    <!-- 设置excel为显示模式 -->
    <!-- <% response.setHeader("Content-disposition","inline; filename=test.xls"); %> -->
    <!-- 设置excel为下载模式 -->
    <% response.setHeader("Content-disposition","attachment; filename=test.xls"); %>
    <html>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <head>
    <title>报表</title>    
    </head>
    <body>
        <CENTER>
             <table cellpadding="1" cellspacing="1"  border="1">
                  <tr>
                          <td colspan="5" align="center">报表</td>
                  </tr>
                    <tr class="dan_tr">
                           <th>使用时间</th>
                           <th>使用者</th>
                           <th>传播者</th>
                           <th>使用地点</th>
                           <th>消耗积分</th>
                    </tr>
              <c:forEach var="list" items="${list}">
                  <tr align="center">
                       <td width="135">${list.userDate}</td>
                       <td width="100">${list.userName}</td>
                       <td width="100">${list.puserName}</td>
                       <td width="350">${list.userCorp}</td>
                       <td>${list.integral}分</td>
                  </tr>
              </c:forEach>
             </table>
        </CENTER>
    </body>
    </html>
  • 相关阅读:
    JavaScript 弹窗
    创建对象构造器
    DOM事件
    document对象“还在更新”
    JavaScript 闭包
    使用 "use strict" 指令
    constructor 属性
    2019暑期集训第一周小结
    无向图求割边
    矩阵快速幂
  • 原文地址:https://www.cnblogs.com/AndroidJotting/p/5024504.html
Copyright © 2020-2023  润新知