But at this point if your website user try to download the report file, it is saved as “myJasperTest.action”. User has to rename it as “someFileName.pdf” or “someFileName.xls” to view it in appropriate program. You can make user’s life easier by just adding a few lines into “struts.xml” file in every jasper related result. Following parameters are for PDF report result.

Here you have statically define the file name as “document”. User will always see the file “document.pdf” or “document.xls”. But if you want to dynamically change the file name, it will need a little more effort. Just change the following line

filename="document.pdf"

with the following one

filename="${fileName}.pdf"

You have given “fileName” as place holder. Now You have to provide a field and accessor of given place holder in you action class. In this case, we have “com.acme.test.action.JasperAction” as described in the tutorial.