Hi,

Try the "Content-disposition" header.
It seems to work with MS Internet Explorer and Netscape browsers - I have
not tested others.

If you want to return a RTF file named MyFilename.rtf, it could be done like
this:

class MyServlet extends javax.servlet.http.HttpServlet{
...
  public void doGet(HttpServletRequest req,HttpServletResponse res)
        throws javax.servlet.ServletException, java.io.IOException{
                        ...
                res.setContentType("text/rtf");
                res.setHeader("Content-disposition",
"filename=MyFilename.rtf");
                        ...
  }
}

Regards,
Tõnu

> -----Original Message-----
> From: cga [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 18, 2001 6:44 AM
> To: [EMAIL PROTECTED]
> Subject: default file name in download
> 
> 
> Hi there,
> 
>     I am doing a servlet that presents the output in two 
> flawors. The first
> one is a html page, I use a jsp.
>     The second one is a downloable file which I generate 
> throught a jsp.
> Changing the content-type is easy. But I would like to give the file a
> download name. I mean, when the user clicks on the save 
> button he would have
> a default name that I will give. I mean, something like 
> 'usefuldata.dat'
> instead of 'MyServlet'.
>     Does anybody knows how to do it?
> 
> Thanks in advance,
> 
> Carlos Gaston Alvarez
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to