Just set the Mime type to something else that the browser won't recognize:

res.setContentType("text/plain-x");

Or something similiar.

- Jon

Carlos Santos wrote:

> Hi,
>
> Does anyone know how to make a redirection to a file from a servlet, in a
> way that the browser opens the "File Save as" dialog box immediately no
> matter the file's extension ? Every time i try to redirect to a text file
> (even if the extension is .xyz) it shows the file on screen instead of
> allowing the person to save immediately.
>
> My servlet exports a bit of content of a database to a text file and as
> soon as the text file is created, i want the users browser to open the
> "File Save as" dialog box. Don't know how, though.
>
> I'm pretty sure it has something to do with MIME types.
> Any help will be appreciated.
>
> Thanks,
> Carlos.
>
> -----------------------------------------------------
> CARLOS SANTOS  (ICQ: 21537583)
> NETOSFERA: http://www.netosfera.pt
> Tel(Phone): (+351 53 276998)
> Fax: (+351 53 274255)
> Braga - Portugal
>
> ___________________________________________________________________________
> 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

___________________________________________________________________________
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