N
Niraj Agarwal
Hi,
I am trying to download a tab-delimited file to client machine using
servlet.
I am using IE5.5 browser to test the application.
Here is the code in my servlet, which is sending the file to the
client machine.
ServletOutputStream out = response.getOutputStream();
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "inline;
filename=\""+getFileNameOnly()+".xls\"");
// Generate tab delimited string buffer
StringBuffer sbRet = generateXlsFormat();
// Send it to client
out.write(sbRet.toString().getBytes());
out.close();
I want to download (open) this file directly to a new browser window,
or in excel with the filename i am passing from the servlet.
The problem is that, it opens the file in excel but the file name is
the url that i posted to get this file, it is not that i set in
servlet.
I tried all permutations and combinations but nothing is working.
Can someone please help me out to resolve this problem?
Thanks in advance,
Niraj
I am trying to download a tab-delimited file to client machine using
servlet.
I am using IE5.5 browser to test the application.
Here is the code in my servlet, which is sending the file to the
client machine.
ServletOutputStream out = response.getOutputStream();
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "inline;
filename=\""+getFileNameOnly()+".xls\"");
// Generate tab delimited string buffer
StringBuffer sbRet = generateXlsFormat();
// Send it to client
out.write(sbRet.toString().getBytes());
out.close();
I want to download (open) this file directly to a new browser window,
or in excel with the filename i am passing from the servlet.
The problem is that, it opens the file in excel but the file name is
the url that i posted to get this file, it is not that i set in
servlet.
I tried all permutations and combinations but nothing is working.
Can someone please help me out to resolve this problem?
Thanks in advance,
Niraj