waysun一路阳光

不轻易服输,不轻言放弃.--心是梦的舞台,心有多大,舞台有多大。踏踏实实做事,认认真真做人。

  BlogJava :: 首页 :: 新随笔 :: 联系 ::  :: 管理 ::
  167 随笔 :: 1 文章 :: 64 评论 :: 0 Trackbacks

<%@ page contentType="text/html; charset=utf-8" language="java" import="java.io.*,java.net.*" errorPage="" %>
<%@ page import="com.easyvary.form.util.*"%>
<%@ page import="java.io.*"%>
<%@ page import="java.util.*"%>
<%@ page import="javax.servlet.*"%>
<%@ page import="net.sf.hibernate.*"%>
<%@ page import="org.apache.commons.fileupload.*"%>
<%@ page import="com.easyvary.common.util.*"%>
<%@ page import="com.easyvary.form.*"%>
<%@ page import="com.easyvary.form.util.*"%>
<%@ page import="com.easyvary.system.*"%>
<%@ page import="com.easyvary.system.GmccObject"%>
<%@ page import="com.bpm.pm.*"%>
<%@page import="proc.pm.monitor.CellAlarm"%>
<%@page import="proc.ibpm.alarm.*" %>
<%@page import="proc.ibpm.global.*" %>
<%@page import="com.ibpm.conf.*" %>
<%@page import="proc.ibpm.structure.*" %>
<%@ page import="proc.ibpm.conf.*"%>
<%@page import="proc.ibpm.history.*" %>
<%
 Get get = new Get();
 HistoryAlarmProcessor hap = new HistoryAlarmProcessor();
 String cellTypeConfId = request.getParameter("cellTypeConfId");
 if(cellTypeConfId==null){
  cellTypeConfId = "";
 }
 String cellConfId = request.getParameter("cellConfId");
 String startAlarmTime = request.getParameter("startAlarmTime");
 String endAlarmTime = request.getParameter("endAlarmTime");
 String startRecoverTime = request.getParameter("startRecoverTime");
 String endRecoverTime = request.getParameter("endRecoverTime");
 String recoverType = request.getParameter("recoverType");
 
 String cellTypeShowName = get.getCellTypeShowName(cellTypeConfId);
 hap.setRecordCount(cellTypeConfId,cellConfId,startAlarmTime,endAlarmTime,startRecoverTime,endRecoverTime,recoverType);
 hap.setPageTotal(cellTypeConfId,cellConfId,startAlarmTime,endAlarmTime,startRecoverTime,endRecoverTime,recoverType);
    String filepath="test.txt";//request.getParameter("path");
    // 设置HTTP头:
    response.reset();
    response.setContentType("application/octet-stream");
    String fileName= URLDecoder.decode(filepath,"utf-8");
    java.net.URLEncoder.encode(fileName, "utf-8");
    response.addHeader("Content-Disposition","attachment;"+ "filename=\"" +URLEncoder.encode(fileName, "utf-8") + "\"");
    BufferedOutputStream output = null;
    BufferedInputStream input = null;
    OutputStream os =null;
    //FileInputStream fis =null;
    // 写缓冲区:
    try
    {
                   
                    os = response.getOutputStream();
                    String historyAlarm="";//historyAlarm为后台得到的数据
                    byte[]byt=historyAlarm.getBytes();
                   os.write(byt);

    }
    catch(Exception e)
    {
        System.out.println(e);
    }
    finally
    {
        //fis.close();
     os.flush();
     os.close();
        if(input!=null) input.close();
        if(output!=null) output.close();
    }
    return;


%>

posted on 2008-08-14 10:18 weesun一米阳光 阅读(5037) 评论(2)  编辑  收藏 所属分类: 总结备用

评论

# re: jsp导出TXT文件 2012-12-04 18:55 阿什顿
水电费是打发士大夫告诉对方告诉对方公司的风格  回复  更多评论
  

# re: jsp导出TXT文件 2013-06-02 17:55 jjkk
nnnn  回复  更多评论
  


只有注册用户登录后才能发表评论。


网站导航: