[jboss-user] [JBoss Seam] - changing response headers to modify filename for excel
do-not-reply at jboss.com
Thu Dec 13 13:18:52 EST 2007
I'm trying to open a report in Excel, with a specified dynamic filename
I have an xhtml page that spits out simple tabulated data. On viewing that page ID I call a method from pages.xml that does this:
| HttpServletResponse response = (HttpServletResponse)ctx.getExternalContext().getResponse();
| response.setHeader("Content-Disposition","attachment;filename=\"" + fileName + "\"");
This works... the report is generated correctly, and with the right filename etc. However, intermittently, the spreadsheet that opens will have both the report that just ran, and the previous one in it! (I should mention there are several different report pages, with different filenames - set up exactly the same as above).
It appears perhaps the response is not closing or something like that??
I tried this:
// TODO This is such a hack it's untrue (closes response after 5s)
but although it doesn't seem to do any harm, it doesn't fix the intermittent problem.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4112672#4112672
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4112672
More information about the jboss-user