Hello All
            I have code for downloading a text file a server to the local system in a 
JSP page and not as a seperate Servlet,but it is giving me a  "IllegalStateException" 
....the snippet of the code is 

             String fname1 = ""+user.getBusinessId();
             String fname2 = ""+user.getAccountId();
             String fname = fname1+"-"+fname2+".txt";
             response.setContentType("text/plain");
             response.setHeader("Content-Disposition","multi-part 
attachment;filename=\""+fname+"\";");
             ServletOutputStream stream = null;
             try {    
             BufferedInputStream bif = new BufferedInputStream(new 
FileInputStream("c:/ssmtech/download/customers/"+fname)); 
            int data;
            stream = response.getOutputStream();///  It is giving me a 
IllegalStateException  out here.....
            while(( data = bif.read()) != -1) {
            stream.write(data);
             }
                bif.close();
                    stream.close();
              } catch(Exception e) {
              }
                     finally {
                        if (stream != null)
                        stream.close();
          } 
       


            I am working on a J2EE Application Server.....and on EJB......
            Please anybody can help me out with.this .........it is Urgent 


Sam

==========================================================================To 
unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to