出现 IllegalStateException 可能的原因是你的页面已经转到其它地方去了。

解决方案 »

  1.   

    完整代码:
    view_attachment.jsp //是对TRS数据库操作,不过都无所谓
    //////////////////////////////////////////////////////
    就是最后几行出错
    getOutputStream() has already been called 这个错误大侠们应该很清楚吧
    //////////////////////////////////////////////////////
    <%@ page import="com.eprobiti.trs.*,java.io.*,java.sql.*" contentType="text/html;charset=GBK"%><jsp:useBean id="trscon" scope="session" class="com.eprobiti.trs.TRSConnection"/><%
    long lRecNo;
    int iColNo = 6;
    int iIndex;
    String strParam;
    strParam = request.getParameter("id");
    lRecNo = Long.parseLong(strParam);
    // strParam = "1";//request.getParameter("multino");
    iIndex = Integer.parseInt(strParam);
    com.eprobiti.trs.TRSResultSet trsrs2 ;String strIP = "172.21.10.33";
    String strPort = "8888";
    String strUser = "system";
    String strPass = "manager";
    boolean trsIsConnect=false;
    try
    {
    if (trscon.isClosed())
    {
    trscon = new com.eprobiti.trs.TRSConnection();
    trscon.connect(strIP, strPort, strUser, strPass);
    session.setAttribute("trscon", trscon);
     }
     trsIsConnect = true;
    }
    catch(Exception ex)
    {
    ex.printStackTrace();
    }trsrs2= new com.eprobiti.trs.TRSResultSet();
     trsrs2.setConnection(trscon);
    String strWhere = "";//"file_id="+request.getParameter("file_id");
         if(trsrs2.isClosed())
       {
    trsrs2.executeSelect("cieccinfo", strWhere, "", "", "", 0, com.eprobiti.trs.TRSConstant.TCE_OFFSET, false);
    trsrs2.setReadOptions(com.eprobiti.trs.TRSConstant.TCE_OFFSET,"",";");
           }
    try
    {
    trsrs2.moveTo( 0,iIndex );
    byte[] photo = trsrs2.getBytes(iColNo, 0 );
    javax.servlet.ServletOutputStream outx = response.getOutputStream();
    outx.write(photo,0,photo.length);
    photo=null;
    }
    catch(TRSException ex)
    {
    ex.printStackTrace();
    }
    %>
      

  2.   

    一般getOutputStream() has already been called是什么引起的呢
      

  3.   

    Calling flush() on the PrintWriter commits the response. 
      

  4.   

    调用flush()后程序运行 没问题了,但是log文件中 还是报错,而且会导致系统崩溃,????????????????????????????