设置jsp的返回结果为独立的文件(不在浏览器中直接打开)

String filename=  "侬好.txt";
filename = URLEncoder.encode(filename,"utf-8");   
response.setHeader("Content-disposition","attachment; filename="+filename);

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.