jsp download file

dear \helper

can you help me to download a file (of any type) from server to client in a jsp code without it be opened in the browser {i.e. when user clicks the name which links to the file appear to him the save dialoge box to save the file where he choose}

is this pssible

thanks

Aly noor junior java developer

[344 byte] By [aly_noora] at [2007-9-24]
# 1

Just add these two line to your jsp.

response.setHeader("Content-Disposition", "attachment; filename= " + file + ".ext");

out.print(text);

where

1) file = filename u want to display on the dialog box and also the name with which the file will be saved.

2) ext = extension of the file u want to save the file.

3) text = actual contents of the file which u want to write in the file.

M.Rizwana at 2007-7-15 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 2
Plz do this <% response.setHeader("Content-Disposition", "filename=D:/myDatabase/status.xls, attachement;"); %>I hope it works for u. Thanks!Deven
21deven@gmail.coma at 2007-7-15 > top of java,Enterprise & Remote Computing,Web Tier APIs...