To set a dynamic filename in annotated results.
In Action class:
private String date;
//Above the action handling the download:
@Result(name = "success", type= StreamResult.class,
params = {"contentType", "application/vnd.ms-excel",
"contentDisposition", "attachment; filename=report_$(date).xls"},
value = "reportFileStream"
)
//The usual getter/setter:
public String getDate(){
return date;
}
public void setDate(String date){
this.date = date;
}
No comments:
Post a Comment