JSP生成Excel报表

JSP代码
 1 <%@ page contentType="text/html; charset=UTF-8" %>
 2 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
 3 <% response.setContentType("application/vnd.ms-excel;charset=UTF-8"); %>
 4 <!-- 设置下载文件的文件名 -->
 5 <!-- 设置excel为显示模式 -->
 6 <!-- <% response.setHeader("Content-disposition","inline; filename=test.xls"); %> -->
 7 <!-- 设置excel为下载模式 -->
 8 <% response.setHeader("Content-disposition","attachment; filename=test.xls"); %>
 9 <html>
10 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
11 <head>
12 <title>报表</title> 
13 </head>
14 <body>
15 <CENTER>
16 <table cellpadding="1" cellspacing="1" border="1">
17 <tr>
18 <td colspan="5" align="center">报表</td>
19 </tr>
20 <tr class="dan_tr">
21 <th>使用时间</th>
22 <th>使用者</th>
23 <th>传播者</th>
24 <th>使用地点</th>
25 <th>消耗积分</th>
26 </tr>
27 <c:forEach var="list" items="${list}">
28 <tr align="center">
29 <td width="135">${list.userDate}</td>
30 <td width="100">${list.userName}</td>
31 <td width="100">${list.puserName}</td>
32 <td width="350">${list.userCorp}</td>
33 <td>${list.integral}分</td>
34 </tr>
35 </c:forEach>
36 </table>
37 </CENTER>
38 </body>
39 </html>

 

转载于:https://www.cnblogs.com/wjxhero/p/6293112.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值