struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ManiKanta G <>
Subject Re: [S2] downloadaction class
Date Tue, 15 Jul 2008 10:05:48 GMT
My pleasure.

You can use any variable from the returning action class as with case of 
remaining results, as below

            <result type="stream">
                  <param name="contentType">text/csv</param>
                  <param name="inputName">inputStream</param>
                  <param name="bufferSize">1024</param>
                  <param name="parse">true</param>

Define a instance variable holding the file name (should have getters 
and setters) and use that variable in the config xml as above. Actually 
you can use this type of referencing the action variables in config file.


Riccardo Mollame wrote:
> Thanks pal,
> it's been very kind of you: but is the name of the file hardcoded in the conf file?!?
> I'll try something ASAP and, eventually, abuse one more time of your kindness (let's
hope not!! ;-))...
> My best.
>        Riccardo
> ----- Messaggio originale -----
> Da: ManiKanta G <>
> A: Struts Users Mailing List <>
> Inviato: Martedì 15 luglio 2008, 9:51:38
> Oggetto: Re: [S2] downloadaction class
> 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
>> Any help appreciated.
>> Thanks.
>>               Ric
>>       Posta, news, sport, oroscopo: tutto in una sola pagina. 
>> Crea l'home page che piace a te!
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> For additional commands, e-mail:
> ********** 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
>       Posta, news, sport, oroscopo: tutto in una sola pagina. 
> Crea l&#39;home page che piace a te!
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message