Hello Arvid,

thanks for the tips - now it works just the way I want it.

Best regards,

Stefan.

Arvid Hülsebus schrieb:
> There is a related example in the demo:
>
> http://tobago.atanion.net/tobago-example-demo/faces/best-practice/non-faces-response.jsp
>
>
> http://myfaces.apache.org/tobago/tobago-example/tobago-example-demo/xref/org/apache/myfaces/tobago/example/demo/bestpractice/BestPracticeController.html#46
>
>
> Regards,
> Arvid
>
> Arvid Hülsebus wrote:
>> Hello,
>>
>> IMO you currently cannot produce 2 different results. Therefore you
>> will have to disable the transition effect for the command like this:
>>
>> <tc:button label="Export" action="#{controller.export}"
>> transition="false"/>
>>
>> If you are setting a target attribute like "_blank" the transition is
>> disabled automatically.
>>
>> Regarding the content disposition. In the past I had some problems
>> with this, too. I have to check how I solved it back then. Looking at
>> the RFC I see there is a parameter name missing. Perhaps the
>> following works::
>>
>> Content-Disposition: attachment; filename=workbook.xls
>>
>> Regards,
>> Arvid
>>
>> Stefan Hedtfeld wrote:
>>> 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.
>>>
>>>
>>>
>>>   
>>
>

Reply via email to