I want to realize file automatically function.File located c:\1.txt,when user explore
this page,IE reminder user if download file "1.txt".I write following code.But when I
explore this page,IE didn't remind me if download file and it didn't domnload file at
all.How to correct following code to realize automatically download? What errors is in
my code?
public void doPost(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
response.setContentType(CONTENT_TYPE);
String file_name=new String("c:\\1.txt");
response.setHeader("Content-Disposition","attachment;filename="+file_name);
PrintWriter out = response.getWriter();
out.println(data);
}
Thanks in advances!
Edward
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant archives, FAQs and Forums on JSPs can be found at:
http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
http://forums.java.sun.com
http://www.jspinsider.com