I do the same, but with an excel, and I'm able to write the excel direclty to an input stream. I don't know about word, but I suppouse it would be the same. Also, I think you can set a getFileName method in the action, and it can be used as follows
<param name="contentDisposition">attachment;filename="{fileName}"</param> Sent via BlackBerry from T-Mobile -----Original Message----- From: maven apache <apachemav...@gmail.com> Date: Mon, 27 Dec 2010 19:26:16 To: Struts Users Mailing List<user@struts.apache.org> Reply-To: "Struts Users Mailing List" <user@struts.apache.org> Subject: change the filename to be downloaded Hi: In myapplication,I have to generate a ms-word file(I use the apache poi). 1)first I save the generated file to disk. 2)set the inputstream according to the file.Of course,the action result type is already set to stream. here is a exmapleI found about file downing: http://www.mkyong.com/struts2/struts-2-download-file-example/ Now,my problem is how to set the filename? Since the filename is set in the action in the struts.xml. <param name="contentDisposition">attachment;filename="fileABC.txt"</param> Is there any way can set the filename dynamicly? BTW,is there some idea can avoid the step for storing the tmp file in the disk?