JSP Excelレポートの生成

4838 ワード

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>