@Namespace("/file") @Results( { @Result(name="ex",type="stream",params={"contentType","application/vnd.ms-excel", "inputName","excelFile","contentDisposition","attachment;filename=${downFileName}" }) } ) public abstract class ExcelAction extends ActionSupport { private static final long serialVersionUID = 1L; public static String templateFileName = ServletActionContext.getServletContext().getRealPath("templates")+File.separator; private String fileName="default"; public abstract InputStream getExcelFile(); public String getDownFileName(){ return (fileName+".xls"); } @Override public String execute() throws Exception { return "ex"; } public void setFileName(String fileName) { this.fileName = fileName; } }