I am hvaing trouble sending a file as a result of a post in a HTML form
using a servlet. The file has to be generated for each request. .

After the user has recieved the file, then IE "hangs". It doesn't switch
screen when I press a hyperlink and I have to press "refresh" to continue. I
have included my code. Any help would be most appreciated!

String toSend = "<file><data>testdata</data></file>";
try
{
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition","attachment;
filename=Log.xml;");
PrintWriter out = response.getWriter();
out.println(toSend);
out.close();
}
catch (Exception e)
{
ServletOutputStream out = response.getOutputStream();
response.setContentType("text/html");
out.println("<html>");
out.println("<head><title>Error</title></head>");
out.println("An error has occured <br>");
out.println("</body>");
out.println("</html>");
}