zoukankan      html  css  js  c++  java
  • 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>
  • 相关阅读:
    102/107. Binary Tree Level Order Traversal/II
    110. Balanced Binary Tree
    SQL SERVER select,update,delete使用表别名
    C# 有哪些集合
    C# 流总结
    How ASP.NET MVC Works ? (Artech)
    c#扩展方法
    使用缓存的九大误区
    9中浏览器端缓存
    理解AppDomain和AppPool
  • 原文地址:https://www.cnblogs.com/AndroidJotting/p/5024504.html
Copyright © 2011-2022 走看看