step1:
首先在你的Action类中有一个属性(你要动态设置的文件名),必须有获取这个属性的getter方法:
private String fileName="struts.jpg";
public String getFileName(){
return fileName;
}
step2:
配置struts.xml,使用表达式语言动态的获取Action 类中的文件名:
attachment;filename="${fileName}"
over,望采纳,求积分
response.setContentType( "application/vnd.ms-excel;charset=gbk");
response.setHeader( "Content-Disposition ","attachment; filename=" + 你要替换的名字);