怎樣將Jsp頁面的數據導入Excel中?

解决方案 »

  1.   

    直接讲页面数据导出导XLS,
    (1)要么在服务器端生成XLS,让客户端下载
    (2)要么在客户端用Javascript调用Excel
      

  2.   

    这个问题好像有人问过
    服务器段生成XLS 直接下载。
      

  3.   

    我要用jxl實現,但網上的資料說的有些模糊,不知道該怎麼實現.
      

  4.   

    放到服务器端,
    String aQuery="";String isSelect="Y";
    try{aQuery=request.getParameter("query").trim();}catch(Exception e){aQuery="Y";}
    if(aQuery.equals("N")){try{list=(ArrayList)session.getValue("sReport");}catch(Exception e){List=null;}}else{if(isSelect.equals("Y")){List=类名.方法(参数)session.putValue("sReport",list);}}
    另存为Excel页
    <% @page import="..." session="true" contentType="application/vnd.ms-excel;charset=gb2312"%>
    <%try{list=(ArrayList)session.getValue("sReport");}catch(Exception e){list=null}
    response.setHeader("Content-disposition","attachment;filename=Report.xls");%>