If "download window" is that little dialog the browser shows about whether to download a file: it's a browser feature. There is no such thing in HTML. For it to pop up, you need to stream out the data accompanied with the according MIME type. Definitely not the thing JSPs can do. You need a servlet for that.
Hi, this can be done.
Write a new jsp, in which you read the file using a stream and write this stream to the response stream mentioning the application type.
You would call this jsp from a link or a button to open in a new window (like yahoo download). And this jsp would prompt with a dialog box to save the file. (A disadvantage is that, the new window cannot be closed on its own after download is complete)
Here is an excerpt of code from one of my jsps :
<%
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment; filename=\"FairValueFiles" + (new SimpleDateFormat("MM-dd-yyyy").format(new Date())) + ".zip\"");
%>
<%
byte[] buffer = new byte[1024];
String outFilename = "/dir/myFile.zip";
FileInputStream fin = new FileInputStream(outFilename);
BufferedInputStream bin = new BufferedInputStream(fin);
int length;
while ((length = bin.read(buffer)) != -1)
{
response.getOutputStream().write(buffer, 0, length);
}
fin.close();
bin.close();
response.getOutputStream().close();
%>