You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Riccardo Mollame <rm...@yahoo.it> on 2008/07/15 09:34:51 UTC

[S2] downloadaction class

Can anyone tell me if DownloadAction (or something simlar) is still supported in S2?
Any help appreciated.
Thanks.
             Ric


      Posta, news, sport, oroscopo: tutto in una sola pagina. 
Crea l&#39;home page che piace a te!
www.yahoo.it/latuapagina

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


Re: [S2] downloadaction class

Posted by ManiKanta G <ma...@sifycorp.com>.
Yes, it is even pretty simple in S2.

You can use result of type 'stream' for that action configuration.

Use a InputStream to read the content you want to provide as the 
download, and specify the same name in the result config, as below

        <action name="Report" class="com.domain.ReportAction">
            <result type="stream">
                  <param name="contentType">text/csv</param>
                  <param name="inputName">inputStream</param>
                  <param 
name="contentDisposition">filename="Report.csv"</param>
                  <param name="bufferSize">1024</param>
            </result>
        </action>

Here 'inputStream' value of the 'inputName' param is the name of the 
instance variable of type InputStream in the action file.

Hope this will clarify your doubt, and feel free to reply if you are 
having any more doubt. I can provide some code if you need. But my 
sincere suggestion is first try it by yourself.

ManiKanta



Riccardo Mollame wrote:
> Can anyone tell me if DownloadAction (or something simlar) is still supported in S2?
> Any help appreciated.
> Thanks.
>              Ric
>
>
>       Posta, news, sport, oroscopo: tutto in una sola pagina. 
> Crea l&#39;home page che piace a te!
> www.yahoo.it/latuapagina
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>   




********** DISCLAIMER **********
Information contained and transmitted by this E-MAIL is proprietary to 
Sify Limited and is intended for use only by the individual or entity to 
which it is addressed, and may contain information that is privileged, 
confidential or exempt from disclosure under applicable law. If this is a 
forwarded message, the content of this E-MAIL may not have been sent with 
the authority of the Company. If you are not the intended recipient, an 
agent of the intended recipient or a  person responsible for delivering the 
information to the named recipient,  you are notified that any use, 
distribution, transmission, printing, copying or dissemination of this 
information in any way or in any manner is strictly prohibited. If you have 
received this communication in error, please delete this mail & notify us 
immediately at admin@sifycorp.com