You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Thomas Chang <th...@yahoo.de> on 2007/01/26 10:14:50 UTC

A question about file-download

Hi,

My code look as follow. What I want to do is: I generate a file in run-time and put it under a dir in server-side, assumed under "c:\temp\myfile.txt". If one clicks the commmanlink, a pop-up dialog for file-download will be shown and one can chose a dir in local to save the file. I wonder if I can use my following code to do so. And I want to know how can I write the function fileDownlaod() in my backing bean.

Or one can do this in an other way?

Thanks

Thomas

myJSF.xhtml
*************
...
<t:commandLink id="csvDownload" value="File download" action="#{fileuploadBean.fileDownload}" immediate="true"></t:commandLink>
...


MyBean.java
*************
...
 fileDownload(){
  }
...


 		
---------------------------------
Besseren Schutz gegen Spam - jetzt bei dem neuen Yahoo! Mail .

A question about showing/opening PDF-file in run-time

Posted by Thomas Chang <th...@yahoo.de>.
Good day everybody,

My code look as follow. What I want to do is: I generate a pdf-file in run-time and put it under a dir in server-side, assumed under "c:\temp\myfile.pdf". If one clicks the commmanlink, the PDF-file will be opened in a new browser window with tool-bar which contains save, print etc.
   
  My code look as follow. And I want to know how can I write the function showPDF() in my backing bean. 

Or one can do this in an other way?

Thanks

Thomas
  

myJSF.xhtml
*************
...
<t:commandLink id="csvDownload" value="File download" action="#{fileBean.showPDF }" immediate="true"></t:commandLink>
...


MyBean.java
*************
...
 showPDF(){
  ...
  }
...



 		
---------------------------------
NEU: Fragen stellen - Wissen, Meinungen und Erfahrungen teilen. Jetzt auf Yahoo! Clever.

Re: A question about file-download

Posted by Thomas Chang <th...@yahoo.de>.
I've tried this example and it works quite well. But I have now another problem. I.e.: after I've saved the file and close the download dialog. It doesn't change to another xhtml-page (assumed downloadOK.xhtml. See my code shown as follow). It stay by myJSF.xhtml.
   
  Who knows why?
   
  Thanks
   
  Thomas
   
  ...
  myJSF.xhtml
*************
...
<t:commandLink id="csvDownload" value="File download" action="#{fileBean.fileDownload }" immediate="true"></t:commandLink>
...


MyBean.java
*************
...
 fileDownload(){
    ...
    return "downloadOK"
  }
...

  faces-config.xml
  *******************
  <navigation>
      <from>downloadOK</from>
  ... <to>downloadOK.xhtml</to>
  </navigation>
  ...

  
Adrian Mitev <ad...@googlemail.com> schrieb:
  See here - http://wiki.apache.org/myfaces/Sending_Files

  2007/1/26, Thomas Chang <thomas2004ch@yahoo.de >:  Hi,

My code look as follow. What I want to do is: I generate a file in run-time and put it under a dir in server-side, assumed under "c:\temp\myfile.txt". If one clicks the commmanlink, a pop-up dialog for file-download will be shown and one can chose a dir in local to save the file. I wonder if I can use my following code to do so. And I want to know how can I write the function fileDownlaod() in my backing bean. 

Or one can do this in an other way?

Thanks

Thomas

myJSF.xhtml
*************
...
<t:commandLink id="csvDownload" value="File download" action="#{fileuploadBean.fileDownload }" immediate="true"></t:commandLink>
...


MyBean.java
*************
...
 fileDownload(){
  }
...

  
  
---------------------------------
  Besseren Schutz gegen Spam - jetzt bei dem neuen Yahoo! Mail .   




 		
---------------------------------
Was Sie schon immer wissen wollten aber nie zu Fragen trauten? Yahoo! Clever hilft Ihnen.

Re: A question about file-download

Posted by Thomas Chang <th...@yahoo.de>.
Perfect! Thanks!



Adrian Mitev <ad...@googlemail.com> schrieb: See here - http://wiki.apache.org/myfaces/Sending_Files

2007/1/26, Thomas Chang <thomas2004ch@yahoo.de >:Hi,

My code look as follow. What I want to do is: I generate a file in run-time and put it under a dir in server-side, assumed under "c:\temp\myfile.txt". If one clicks the commmanlink, a pop-up dialog for file-download will be shown and one can chose a dir in local to save the file. I wonder if I can use my following code to do so. And I want to know how can I write the function fileDownlaod() in my backing bean. 

Or one can do this in an other way?

Thanks

Thomas

myJSF.xhtml
*************
...
<t:commandLink id="csvDownload" value="File download" action="#{fileuploadBean.fileDownload }" immediate="true"></t:commandLink>
...


MyBean.java
*************
...
 fileDownload(){
  }
...

    

---------------------------------
Besseren Schutz gegen Spam - jetzt bei dem  neuen Yahoo! Mail  . 


 

 		
---------------------------------
Yahoo! Messenger -  kostenlos* mit Familie und Freunden von PC zu PC telefonieren. 

Re: A question about file-download

Posted by Adrian Mitev <ad...@googlemail.com>.
See here - http://wiki.apache.org/myfaces/Sending_Files

2007/1/26, Thomas Chang <th...@yahoo.de>:
>
> Hi,
>
> My code look as follow. What I want to do is: I generate a file in
> run-time and put it under a dir in server-side, assumed under
> "c:\temp\myfile.txt". If one clicks the commmanlink, a pop-up dialog for
> file-download will be shown and one can chose a dir in local to save the
> file. I wonder if I can use my following code to do so. And I want to know
> how can I write the function fileDownlaod() in my backing bean.
>
> Or one can do this in an other way?
>
> Thanks
>
> Thomas
>
> myJSF.xhtml
> *************
> ...
> <t:commandLink id="csvDownload" value="File download" action="#{
> fileuploadBean.fileDownload}" immediate="true"></t:commandLink>
> ...
>
>
> MyBean.java
> *************
> ...
>  fileDownload(){
>   }
> ...
>
> ------------------------------
> Besseren Schutz gegen Spam - jetzt bei dem neuen Yahoo! Mail
> <http://de.rd.yahoo.com/evt=40589/*http://de.docs.yahoo.com/ymail/landing.html+%0A>.
>
>
>