You may try setting the content type to test/plain response.setContentType(
"text/plain" );. However, IE sometimes (not sure why) uses the file extension to
know the file type.
regards,
janco

Partha Bhattacharjee wrote:

> Hi,
>
> I have a servlet that connects to a database, reads it and then creates a
> well formed xml file out of it. Now I have to give users the option of being
> able to download the stuff if they want.
>
> The following code works fine for most of the cases but xml files
>
> import javax.servlet.http.*;
> import javax.servlet.*;
> import java.io.*;
>
> public class content extends HttpServlet
> {
>         public void doPost ( HttpServletRequest request, HttpServletResponse
> response )
>         throws IOException
>         {
>
>                 response.setHeader ( "content-disposition",
> "attachment;filename=test.txt" ) ;
>                 PrintWriter out = response.getWriter () ;
>                 out.println ("<partha></partha>" ) ;
>                 out.close();
>         }
> }
>
> This works fine till the name of the file is test.txt but the moment I make
> it test.xml it gets into some kind of loop and does not download. However
> one can still view it.
>
> As you can see it is a valid xml file and the same code works for all kinds
> of files but xml.
>
> Could anybody out there help? I need it .
>
> brgds
> partha
>
> ___________________________________________________________________________
> 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

--
Janco Tanis

------------------------------------------------------------
      COAS, Your partner in computer aided services

   Nijverheidsweg 34        Tel:   +31 (0) 187 49 3222
   Postbus 44               Fax:   +31 (0) 187 49 2912
   3250 AA Stellendam       Email: [EMAIL PROTECTED]

___________________________________________________________________________
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

Reply via email to