You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Mabusela, Koketso K" <Ko...@standardbank.co.za> on 2006/03/23 10:06:54 UTC

Download through Outputstream

Hi 

 

I am using struts and my application downloads data in a PDF file. To
make sure the download was successful I close the stream or flush it.
Now I want to continue with my session by forwarding to another Struts
action, unfortunately when the request is closed you cannot do a thing.
Is there a way to move to another Struts action in this scenario? 

 

What if you want to give the user a confirmation screen with additional
info?

 

Thanks


__________________________________________________________________________________________________________________________________

Standard Bank Disclaimer and Confidentiality Note

This e-mail, its attachments and any rights attaching hereto are, unless the context clearly indicates otherwise, the property of Standard Bank Group Limited
and/or its subsidiaries ("the Group"). It is confidential, private and intended for the addressee only. Should you not be the addressee and receive this e-mail by
mistake, kindly notify the sender, and delete this e-mail, immediately and do not disclose or use same in any manner whatsoever. Views and opinions
expressed in this e-mail are those of the sender unless clearly stated as those of the Group. The Group accepts no liability whatsoever for any loss or
damages whatsoever and howsoever incurred, or suffered, resulting, or arising, from the use of this email or its attachments. The Group does not warrant the integrity
of this e-mail nor that it is free of errors, viruses, interception or interference. Licensed divisions of the Standard Bank Group are authorised financial services providers
in terms of the Financial Advisory and Intermediary Services Act, No 37 of 2002 (FAIS).
For information about the Standard Bank Group Limited visit our website http://www.standardbank.co.za
___________________________________________________________________________________________________________________________________

Re: Download through Outputstream

Posted by James Mitchell <jm...@apache.org>.
Hi Koketso, I don't think you are going to be able to do what you want, at 
least not the way you describe.  You won't be able to do anything server 
side with the binary stream (pdf) response once it is complete and you won't 
know on the client side when the pdf is finished or hung or whatever.  You 
can't even guarantee that the user even downloaded it.  When prompted for a 
download location, some browsers download in the background while the users 
decide where to put it, which they can always cancel at any point before, 
during, or after the response is complete.

What you could do is present the user with a screen with something like ... 
"Your download should begin in a moment, if it does not, click here" <- and 
link 'here' to the pdf download, all the while using a meta-refresh tag on 
that page that sends the user to the url to download the pdf.

That's pretty much how downloads are done at sf.net, eclipse.org and many 
others.  The difference would be that you would also present them with more 
instructions on the same page, what to do when the download was finished. 
The key is that you would want the user to be prompted to downloaded the 
file, and not let it load in the window or they'll lose those instructions. 
Worst case is that they don't read what you wanted them to do, but that's 
the lesser of all evils in all approaches.

If anyone has a better solution, I'd love to hear it.

--
James Mitchell
Software Engineer / Open Source Evangelist
Consulting / Mentoring
678.910.8017

----- Original Message ----- 
From: "Mabusela, Koketso K" <Ko...@standardbank.co.za>
To: <us...@struts.apache.org>
Sent: Thursday, March 23, 2006 4:06 AM
Subject: Download through Outputstream


Hi



I am using struts and my application downloads data in a PDF file. To
make sure the download was successful I close the stream or flush it.
Now I want to continue with my session by forwarding to another Struts
action, unfortunately when the request is closed you cannot do a thing.
Is there a way to move to another Struts action in this scenario?



What if you want to give the user a confirmation screen with additional
info?



Thanks


__________________________________________________________________________________________________________________________________

Standard Bank Disclaimer and Confidentiality Note

This e-mail, its attachments and any rights attaching hereto are, unless the 
context clearly indicates otherwise, the property of Standard Bank Group 
Limited
and/or its subsidiaries ("the Group"). It is confidential, private and 
intended for the addressee only. Should you not be the addressee and receive 
this e-mail by
mistake, kindly notify the sender, and delete this e-mail, immediately and 
do not disclose or use same in any manner whatsoever. Views and opinions
expressed in this e-mail are those of the sender unless clearly stated as 
those of the Group. The Group accepts no liability whatsoever for any loss 
or
damages whatsoever and howsoever incurred, or suffered, resulting, or 
arising, from the use of this email or its attachments. The Group does not 
warrant the integrity
of this e-mail nor that it is free of errors, viruses, interception or 
interference. Licensed divisions of the Standard Bank Group are authorised 
financial services providers
in terms of the Financial Advisory and Intermediary Services Act, No 37 of 
2002 (FAIS).
For information about the Standard Bank Group Limited visit our website 
http://www.standardbank.co.za
___________________________________________________________________________________________________________________________________


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Download through Outputstream

Posted by Thomas Joseph <th...@kottsoftware.com>.
Hi Mabusela,

Try popping up a new window (try out with target=new attribute for html
anchor element)that should call the action to generate PDF, while continue
with your rest of the action in the parent browser.

Regards,

Thomas Joseph

> ----- Original Message -----
>From: "Mabusela, Koketso K" <Ko...@standardbank.co.za>
>
> Hi
>
>
> I am using struts and my application downloads data in a PDF file. To
> make sure the download was successful I close the stream or flush it.
> Now I want to continue with my session by forwarding to another Struts
> action, unfortunately when the request is closed you cannot do a thing.
> Is there a way to move to another Struts action in this scenario?
>
>
>
> What if you want to give the user a confirmation screen with additional
> info?
>
>
>
> Thanks
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org