A
AA
I create a servlet in Tomcat that pass a file to the client, like this:
// Open the file and output streams
FileInputStream in = new FileInputStream(file);
OutputStream out = response.getOutputStream();
// Copy the contents of the file to the output stream
byte[] buf = new byte[1024];
int count = 0;
while ((count = in.read(buf)) >= 0) {
out.write(buf, 0, count);
}
in.close();
out.close();
}
When the client download the file and save it, the name of the file is
the name of the servlet.
The big question is: how can I show a name that I want instead of the
name of the servlet?
Thank you
Alb
// Open the file and output streams
FileInputStream in = new FileInputStream(file);
OutputStream out = response.getOutputStream();
// Copy the contents of the file to the output stream
byte[] buf = new byte[1024];
int count = 0;
while ((count = in.read(buf)) >= 0) {
out.write(buf, 0, count);
}
in.close();
out.close();
}
When the client download the file and save it, the name of the file is
the name of the servlet.
The big question is: how can I show a name that I want instead of the
name of the servlet?
Thank you
Alb