Basically, in your Action's execute method:

response.setContentType("application/pdf");
File pdf = new File("/home/eweber/public/Foo.pdf");
InputStream in = null;
OutputStream out = null;
try {
in = new FileInputStream(pdf);
out = response.getOutputStream();
int bytesRead = 0;
byte[] buffer = new byte[8192];
while ((bytesRead = in.read(buffer, 0, 8192)) != -1) {
out.write(buffer, 0, bytesRead);
}
}
catch (Exception e) {}
finally {
// close stuff
}
return null; // tell Struts not to forward to anything


Erik



Stefan Groschupf wrote:

Hi,
can someone point me to a resource that describe how to realize a dowanload action?
Do I can write to the response object with out forwarding?


Thanks for any hints.
Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to