jsp를 이용하여 excel 형식 파일 생성

3695 단어
<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="/WEB-INF/tlds/test.tld" prefix="pig"%>
<%@ page language="java" import="org.etone.fs.market.bean.movie.*"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  <html>
      <head>
      
        <title>Excel </title>
        
      </head>
      <meta http-equiv=Content-Type content="text/html; charset=GB2312">
      <meta name=ProgId content=Excel.Sheet>
      <meta name=Generator content="Microsoft Excel 9">
      <meta http-equiv=Content-Type content="text/html; charset=GB2312">
      <%response.setHeader("Content-disposition","attachment;filename=surveywlan_exportData.xls");%>
      <body>
           <table id="list" width="100%" cellpadding="0" cellspacing="1" class="dg_borderstyle" border="1">
                   	  <tr>
		               <th width="10%" style="background-color:#9FBFE3"><div align="center"> </div></th>
		                <th width="10%" style="background-color:#9FBFE3"><div align="center"> </div></th>
		               <th width="13%" style="background-color:#9FBFE3"><div align="center"> </div></th>
		                <th width="12%" style="background-color:#9FBFE3"><div align="center"> </div></th>
		                <th width="12%" style="background-color:#9FBFE3"><div align="center"> </div></th>			                
		              </tr>
		           <s:iterator value="exportSurveyList" id="dto" status="sta">
	                      <tr  onMouseOver="MOver(this)" onMouseOut="Mout(this)" class="dg_alternatingitemstyle">	                        
	                        <td align="center" class="f">
	                        	${dto.recmakedate}
	                        </td>
	                        <td align="center" class="f">
	                        	${dto.type}
	                        </td>
	                        <td align="center" class="f">
	                        	${dto.onlinetype}
	                        </td>
	                        <td align="center" class="f">
	                        	${dto.mobileno}
	                        </td>
	                        <td align="center" class="f">
	                        	${dto.address}
	                        </td>  
	                      </tr>
                  	  </s:iterator>
      </table>
      </body>
    </html>
   

좋은 웹페이지 즐겨찾기