欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

java web 下载

程序员文章站 2022-03-10 16:29:19
...
public void export() throws IOException{
		HttpServletResponse response = Struts2Utils.getResponse();
		Date date = new Date();
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		String fileName = sdf.format(date) + "远程用户";
		fileName = new String(fileName.getBytes("gb2312"), "iso8859-1");
		response.addHeader("Content-Disposition", "attachment; filename="+ fileName + ".txt"); 
		response.setContentType("text/plain");
		PrintWriter out=response.getWriter();
		List<AykjSysUser> users=sysUserService.getAuditedUsers();
			for(AykjSysUser user:users){
			String passwd=interlibUserDao.getInterlibPassword(user.getReadercardno());
			out.write(user.getReadercardno()+","+passwd+","+user.getRealname()+"\r\n");
		}
			out.close();
	}