您的位置首页百科知识

怎么用response对象输出文本文件?

怎么用response对象输出文本文件?

response.setContentType("application/x-msdownload;charset=UTF-8");

response.setHeader("Content-Disposition","attachment;filename=" + java.net.URLEncoder.encode(fileName, "UTF-8"));

fileName 为 文件名