Hi,
I'm using tobago 1.0.10 release on JBoss 4.0.5.
I just implemented an excel export as it is shown in the examples. The
output is generated correctly, a file safe dialog is shown (in firefox 2
on a linux box) and the file is saved. But the UI stays in the "blocked"
state (the running squares). Is there a way to redisplay the page the
user came from?
Code from my controller:
public String export() {
String attachmentName = "workbook.xls";
LOG.info("export called, generating " + attachmentName);
FacesContext context = FacesContext.getCurrentInstance();
Object response = context.getExternalContext().getResponse();
if (response instanceof HttpServletResponse) {
HttpServletResponse servletResponse = (HttpServletResponse) response;
servletResponse.setContentType("application/vnd.ms-excel");
servletResponse.setHeader("Content-Disposition", "attachment; " +
attachmentName);
List<Entry> list = dataService.getData();
workbookService.export(list, servletResponse.getOutputStream());
}
context.responseComplete();
return null;
}
The method is called as an action from a <tc:button>.
BTW: do you know a way to get the attachment name (variable
attachmentName) as the suggested name in the file save dialog? Firefox
suggests the jsp filename (which is editor.jsp in my case), I'd prefer
"workook.xls".
Regards,
Stefan.