public void getText(){
response.setHeader("Content-Disposition", "attachment;filename="
+ new String(("omd_services.sql").getBytes(), "iso-8859-1"));
try {
OutputStreamWriter write = new OutputStreamWriter(response.getOutputStream(), "utf-8");
BufferedWriter writer = new BufferedWriter(write);
StringBuilder sql = new StringBuilder();
sql.append("HELLO WORLD!");
writer.write(sql + "\r\n");
writer.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
"utf-8":防止写入文件乱码
"\r\n":追加数据