Struts2实现将表单数据下载到Excel中

//  核心代码
HttpServletResponse response = ServletActionContext.getResponse();
		
		response.setContentType("application/vnd.ms-excel");
		String fileName = java.net.URLEncoder.encode("员工信息.xls", "UTF-8");
		response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
		
		workbook.write(response.getOutputStream());

struts.xml:

<action name="*" class="{1}" method="{1}">
		</action>
 

你可能感兴趣的:(java,xml,.net,struts,Excel)