导出txt

@RequestMapping(value = "/txt")
	public void exportTxt(HttpServletRequest request, HttpServletResponse response) {

//导出txt文件
		response.setContentType("text/plain");
		String fileName = "产品信息";

		BufferedOutputStream buff = null;
		StringBuffer write = new StringBuffer();
		ServletOutputStream outSTr = null;
		try {
			response.setHeader("Content-Disposition",
					"attachment; filename=" + java.net.URLEncoder.encode(fileName, "UTF-8") + ".txt");// 导出中文名称
			outSTr = response.getOutputStream();// 建立
			buff = new BufferedOutputStream(outSTr);
			String tab = "\r\n";
			String tcb = "\t";
			write.append("产品名称" + tcb);
			write.append("品牌名称" + tcb);
			write.append("商品条码" + tcb);
			write.append("标准号" + tcb);
			write.append("标准名称" + tcb);
			write.append("标准分类" + tcb);
			write.append("产品规格" + tcb);
			write.append("保质期" + tcb);
			write.append("产品成分" + tcb);
			write.append("下单总数量" + tcb + tab);

			buff.write(write.toString().getBytes("UTF-8"));
			buff.flush();
			buff.close();
		} catch (IOException e1) {
			e1.printStackTrace();
		} finally {
			try {
				buff.close();
				outSTr.close();
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}

导入txt..