设置下载信息的头信息

//设置xml文件下载头信息

response.setHeader("Content-type", "application/xml");

response.setHeader("Content-Disposition", "attachment; filename="

+new String(fileName.getBytes("gb2312"), "ISO8859-1")+ ".xml"); // 设置下载头信息

 

 

 

//设置Excel文件下载头信息

res.setHeader("Content-type", "application/vnd.ms-excel");

res.setHeader("Content-Disposition", "attachment; filename="

+ new String(fileName.getBytes("gb2312"), "ISO8859-1")

+ ".xls");// 设置下载头信息

res.setContentType("application/vnd.ms-excel; charset=utf-8");

你可能感兴趣的:(java,string,excel,xml)