Hello!
I wrote an action for downloading a file.
It is necessary to access the response variable (see code below).
I found out, that this manipulation of "response" makes trouble.
Normally after the action is processed a forward will happen. In my case
I want to forward to another page. But I still remain on my old page.
If I avoid the manipulation of the "response" it works fine and the
forward to the other page happens. But I have to manipulate the
response.
There are restrictions for manipulating the "response"??
Dirk
Code for download a file:
--------------------------
DataInputStream in = new DataInputStream(new
FileInputStream(downloadFile));
response.setContentType(contentType);
Integer length = new Integer(fileLength);
response.setContentLength(length.intValue());
response.setHeader("Content-Disposition", "attachment;
filename=\"" + newFileName + "\"");
System.out.println("filename=\\" + newFileName);
PrintWriter out = response.getWriter();
int chr = in.read();
String result = "";
while (chr != -1) {
out.write(chr);
chr = in.read();
}
in.close();
out.flush();
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]