downloading and saving file from server
Hi
I am using this code thatI got from another post to download a file from server
final ServletOutputStream out = response.getOutputStream();
response.setContentType("application/vnd.ms-outlook");
BufferedInputStream is = new BufferedInputStream(new FileInputStream(new File("c:/samplefile/1929312RE_HyCalctest.eml")));
byte[] buf = new byte[4 * 1024]; // 4K buffer
int bytesRead;
while ((bytesRead = is.read(buf)) != -1) {
out.write(buf, 0, bytesRead);
}
out.flush();
is.close();
out.close();
I am having these problems:
1. Instead of downloding the file, its displaying the file in the same page
2. there is no pop up to cofirm with user if user want to download the file or not
3.when i run the servlet directly on browser ,its opening file save dailog.
4.but when i open the servlet through window.open() from jsp page its not opening file dailog ,its just calling servlet and closing window.
Please help me out.....its very important requirement for me

