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>
  • 相关阅读:
    php环境下所有的配置文件以及作用
    获取登陆用户的ip
    curl模拟post和get请求
    linux 下安装php curl扩展
    php常用面试知识点
    git使用步骤
    laravel框架基础知识点
    ci框架基础知识点
    ajax
    Mysql 中需不需要commit
  • 原文地址:https://www.cnblogs.com/AndroidJotting/p/5024504.html
Copyright © 2011-2022 走看看