You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by TeraPico ExaAtto <te...@gmail.com> on 2004/08/26 01:17:19 UTC

File download link?

Hi,

On one of my report page, I need to provide a hyper link for the user
to download the content of the report as a csv file.  When the user
click on that link, the user's browser should pop up a dialog box and
ask the user if he wants to save or open.  I know how to generate the
csv, but how should I ship the csv to the browser so that it will pop
up a save dialog screen?  How should I specify the filename?

Any help / info is appreciated.

Jeffrey

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


Re: File download link?

Posted by Jeffrey Sze <te...@gmail.com>.
Thanks for your explanation.  I really appreciate it.


> To pass data to a custom service, use the service parameter facility:
> http://jakarta.apache.org/tapestry/doc/ComponentReference/ServiceLink.html
> 
> In your service() method, the parameters can be retrieved via:
>     Object[] parameters = super.getParameters(cycle);
> 
> It sounds like you'll want to pass the filter criteria, not the results,
> to your service.
> 
> Paul
> 
> 
> 
> Jeffrey Sze wrote:
> 
> >Thanks for you reply.  I will give it a try.
> >
> >I have not implemented a service before, and I have one more question.
> > How do I pass the data to the service I am going to create?  When I
> >generate my report page, the user pass in some filter and my page
> >execute the query and display the result.  How do I pass this result
> >to the service?  If it is not possible, how do I pass the filters to
> >the service so the service can execute the query again?
> >
> >
> >
> >
> >>Implement a custom IEngineService implementation.  In the service()
> >>method of your custom service, write the csv data to the servlet output
> >>stream.
> >>To specify a filename, add the following content disposition to the
> >>servlet response header:
> >>
> >>response.setHeader("Content-Disposition", "attachment;
> >>filename=myfile.csv");
> >>
> >>Use the ServiceLink component to generate the hyperlink to your custom
> >>service.
> >>
> >>Make sure to define your custom service in your application specification.
> >>
> >>Paul
> >>
> >>
> >>
> >>TeraPico ExaAtto wrote:
> >>
> >>
> >>
> >>>Hi,
> >>>
> >>>On one of my report page, I need to provide a hyper link for the user
> >>>to download the content of the report as a csv file.  When the user
> >>>click on that link, the user's browser should pop up a dialog box and
> >>>ask the user if he wants to save or open.  I know how to generate the
> >>>csv, but how should I ship the csv to the browser so that it will pop
> >>>up a save dialog screen?  How should I specify the filename?
> >>>
> >>>Any help / info is appreciated.
> >>>
> >>>Jeffrey
> >>>
> >>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >>>
> >>>
> >>>
> >>>
> >>>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >>
> >>
> >>
> >>
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>

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


Re: File download link?

Posted by Paul Ferraro <pm...@columbia.edu>.
To pass data to a custom service, use the service parameter facility:
http://jakarta.apache.org/tapestry/doc/ComponentReference/ServiceLink.html

In your service() method, the parameters can be retrieved via:
    Object[] parameters = super.getParameters(cycle);

It sounds like you'll want to pass the filter criteria, not the results, 
to your service.

Paul

Jeffrey Sze wrote:

>Thanks for you reply.  I will give it a try.
>
>I have not implemented a service before, and I have one more question.
> How do I pass the data to the service I am going to create?  When I
>generate my report page, the user pass in some filter and my page
>execute the query and display the result.  How do I pass this result
>to the service?  If it is not possible, how do I pass the filters to
>the service so the service can execute the query again?
>
>
>  
>
>>Implement a custom IEngineService implementation.  In the service()
>>method of your custom service, write the csv data to the servlet output
>>stream.
>>To specify a filename, add the following content disposition to the
>>servlet response header:
>>
>>response.setHeader("Content-Disposition", "attachment;
>>filename=myfile.csv");
>>
>>Use the ServiceLink component to generate the hyperlink to your custom
>>service.
>>
>>Make sure to define your custom service in your application specification.
>>
>>Paul
>>
>>
>>
>>TeraPico ExaAtto wrote:
>>
>>    
>>
>>>Hi,
>>>
>>>On one of my report page, I need to provide a hyper link for the user
>>>to download the content of the report as a csv file.  When the user
>>>click on that link, the user's browser should pop up a dialog box and
>>>ask the user if he wants to save or open.  I know how to generate the
>>>csv, but how should I ship the csv to the browser so that it will pop
>>>up a save dialog screen?  How should I specify the filename?
>>>
>>>Any help / info is appreciated.
>>>
>>>Jeffrey
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>>    
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>  
>


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


Re: File download link?

Posted by Jeffrey Sze <te...@gmail.com>.
Thanks for you reply.  I will give it a try.

I have not implemented a service before, and I have one more question.
 How do I pass the data to the service I am going to create?  When I
generate my report page, the user pass in some filter and my page
execute the query and display the result.  How do I pass this result
to the service?  If it is not possible, how do I pass the filters to
the service so the service can execute the query again?


> Implement a custom IEngineService implementation.  In the service()
> method of your custom service, write the csv data to the servlet output
> stream.
> To specify a filename, add the following content disposition to the
> servlet response header:
> 
> response.setHeader("Content-Disposition", "attachment;
> filename=myfile.csv");
> 
> Use the ServiceLink component to generate the hyperlink to your custom
> service.
> 
> Make sure to define your custom service in your application specification.
> 
> Paul
> 
> 
> 
> TeraPico ExaAtto wrote:
> 
> >Hi,
> >
> >On one of my report page, I need to provide a hyper link for the user
> >to download the content of the report as a csv file.  When the user
> >click on that link, the user's browser should pop up a dialog box and
> >ask the user if he wants to save or open.  I know how to generate the
> >csv, but how should I ship the csv to the browser so that it will pop
> >up a save dialog screen?  How should I specify the filename?
> >
> >Any help / info is appreciated.
> >
> >Jeffrey
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>

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


Re: File download link?

Posted by Paul Ferraro <pm...@columbia.edu>.
Implement a custom IEngineService implementation.  In the service() 
method of your custom service, write the csv data to the servlet output 
stream.
To specify a filename, add the following content disposition to the 
servlet response header:

response.setHeader("Content-Disposition", "attachment; 
filename=myfile.csv");

Use the ServiceLink component to generate the hyperlink to your custom 
service.

Make sure to define your custom service in your application specification.

Paul

TeraPico ExaAtto wrote:

>Hi,
>
>On one of my report page, I need to provide a hyper link for the user
>to download the content of the report as a csv file.  When the user
>click on that link, the user's browser should pop up a dialog box and
>ask the user if he wants to save or open.  I know how to generate the
>csv, but how should I ship the csv to the browser so that it will pop
>up a save dialog screen?  How should I specify the filename?
>
>Any help / info is appreciated.
>
>Jeffrey
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>  
>


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