use a servlet instead of jsp since jsp already has content type set before
coming to ur code. what u say that the client sees the message first is not
possible.
Hardeep
----- Original Message -----
From: "Shailendra" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 16, 2001 6:56 AM
Subject: downloading of file
> hi
> can any body will help me in down loadin of file
> my problem is
> i am writing folowing code in my jsp
> it download the Download.jsp file to the client side but server give the
> error saying
>
> java.lang.IllegalStateException: OutputStream is already being used for
this
> request
>
> code is like that
> <%
> response.setContentType("text/plain");
> response.setHeader("Content-Disposition","attachment;filename=file.txt;");
> InputStream is = null;
>
> File f= new File("Download.jsp");
> FileInputStream fos=new FileInputStream(f);
> BufferedInputStream o=new BufferedInputStream(fos); file://8k
> is=o;
> //... Read InputStream from Database
> OutputStream os = response.getOutputStream();
> if (os != null)
> {
> int c;
> while ( (c = is.read()) != -1)
> {
> os.write(c);
> }
> os.flush();
> os.close();
> }
> is.close();
>
> %>
>
> extra to that(downloading of file)
> i also want that the client shoud have some html page ,when it get
download
> dilogbox(first client see the html page saying download will start
> autometicaly then download start)
>
> shailendra
>
>
===========================================================================
> 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://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
===========================================================================
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://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets