hi,
I want to ask a question about redirecting. I have a link in the test1.jsp to download a file. After I download the file, I want to redirect the user to a page to notify the user. How can I do that?
Below are the original codes i have now:
Test1.jsp
<html>
<head> </head>
<body>
[Download]
</body>
</html>
FileDownload.jsp
<%@ page language="java" import="java.io.*, java.util.*" %>
<%
String filepath = "c:\\DIR-A\\";
String filename = "battleship.pdf";
response.setContentType("APPLICATION/OCTET-STREAM");
response.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");
FileInputStream in = new FileInputStream(filepath + "\\" + filename);
int i;
while ((i=in.read()) != -1) {
out.write(i);
}
in.close();
out.close();
%>
I have tried to add response.sendRedirect("XXX.jsp"); after out.close(); but it doesn't work.
Thanks for suggestions.
cheers,
ypc