hello,
i want to show my PDF file on browser.
i am using
servlet.
now the problem is i want to set the defualt file name when user clicks save as....
String finFileName=t+"-"+timeValFin+".xls";
//diaplying SAVE AS DIALOG
res.setStatus(res.SC_OK);
res.setContentType("application/vnd.ms-excel");
res.setHeader( "Content-Disposition","inline; filename="+ finFileName);
String realPath = this.getServletContext().getRealPath("");
FileInputStream in = new FileInputStream(fileName+".xls");
ServletOutputStream out = res.getOutputStream();
byte[] buf = new byte[1024];
int read = -1;
while ( (read = in.read(buf, 0 , 1024)) != -1)
{
out.write(buf, 0, read);
}
out.flush();
out.close();
this is my code i am using...
now when i press save as button the defualt filename which i specified is not coming instead its taking serrvlet name as filename...
what is the problem in the code.
please help me...
thank you.