Hi Suhail,
Try adding these lines before u write anything in ur file.
res.setContentType("application/type u want") ;
res.setHeader("Content-dispostion", "attachment;filename=" + nameyouwant) ;
res.setContentLength(length) ;
-gopal
>From: Suhail Beig <[EMAIL PROTECTED]>
>Reply-To: "A mailing list for discussion about Sun Microsystem's Java
> Servlet API Technology." <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: How to invoke a Servlet and return a downloadable file using a
> single button
>Date: Fri, 5 May 2000 13:08:35 -0700
>
>Hi all,
>
> I have a very interesting problem at hand.
>
>I have a button named download on my HTML form
>When I click that button it invokes a servlet
>The servlet creates a file on the server by accessing
>database.
>I want this file to be returned back to the user not
>as a HTML file but for download.
>
>Can anybody help..Urgent!!
>
>Thanks
>Suhail
>
>
>__________________________________________________
>Do You Yahoo!?
>Send instant messages & get email alerts with Yahoo! Messenger.
>http://im.yahoo.com/
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html