Hi ,
i want to know that is there any way to provide file download option using
jsp .
currently i am using follwing code for file download option but as this don't allow any
java script to be used in same page. i am facing some problem.
<%
// fetch the file
String filename = "companySecret.txt";
String filepath = "C:\\";
response.setContentType(
"APPLICATION/OCTET-STREAM");
response.setHeader("Content-Disposition",
"attachment; filename=\""
+ filename + "\"");
java.io.FileInputStream fileInputStream =
new java.io.FileInputStream(filepath
+ filename);
int i;
while ((i=fileInputStream.read()) != -1) {
out.write(i);
}
fileInputStream.close();
out.close();
%>