Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

(JSP Servlet) download file from server to client

843840Sep 26 2008 — edited Sep 29 2008
i have some code for download file from server to client. user can select path file to save by dialog open/save/cancel.
after download finish i want to reload jsp page to display data that change. but it s not work, jsp page dont reload. here is my code.

response.reset();
response.setContentType("APPLICATION/OCTET-STREAM");
response.setContentLength(cs);
response.setHeader("Content-Disposition","attachment; filename=\""+tis.getFilename()+"\"");

byte[] nextBytes = new byte[64000];
int nBytesRead;
output = new BufferedOutputStream(response.getOutputStream());
while ((nBytesRead = is.read(nextBytes)) != -1)
{
output.write(nextBytes, 0, nBytesRead);
output.flush();
}
output.close();
is.close();

return mapping.findForward(FORWARD);

how can i fix it? please..

Edited by: leonZz on Sep 25, 2008 9:38 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 27 2008
Added on Sep 26 2008
3 comments
544 views