You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by omidh <om...@gmx.de> on 2007/05/07 08:30:03 UTC
File Download
Hi,
can anyone tell me please, how to make a link for a file download?!
The File is saved in a database (Mysql).
so when I use <h:outputLink value="bean.file">
I get the message that the URL must be absolut.
thansk in advance,
Omid
--
View this message in context: http://www.nabble.com/File-Download-tf3702127.html#a10352716
Sent from the MyFaces - Users mailing list archive at Nabble.com.
Re: File Download
Posted by Josué Alcalde González <ja...@csa.es>.
El lun, 07-05-2007 a las 03:22 -0700, omidh escribió:
> Referencing :
> http://jsffaq.com/Wiki.jsp?ptitle=How+to+download+PDF+file+with+JSF%
> 3F&page=HowToDownloadPDFFileWithJSF
> I would like to know if there is the possibility to resolve the contentType
> "automatically"??
>
I used to save it in database with the content, size, title, name,
etc...
Look here. This turns the extension to a mime type:
http://java.sun.com/products/javabeans/jaf/downloads/index.html
> regards Omid.
>
>
> Josué Alcalde González-2 wrote:
> >
> > El dom, 06-05-2007 a las 23:30 -0700, omidh escribió:
> >> Hi,
> >>
> >> can anyone tell me please, how to make a link for a file download?!
> >> The File is saved in a database (Mysql).
> >>
> >> so when I use <h:outputLink value="bean.file">
> >> I get the message that the URL must be absolut.
> >>
> >> thansk in advance,
> >> Omid
> >
> > There are diferent options:
> >
> > -Download it from an action method using command link or command button:
> >
> > http://jsffaq.com/Wiki.jsp?ptitle=How+to+download+PDF+file+with+JSF%
> > 3F&page=HowToDownloadPDFFileWithJSF
> >
> > - Use a phaseListener to handle downloads of files:
> > http://jroller.com/page/cagataycivici?entry=phaselistener_renders_an_image_no
> >
> >
> >
> > --
> > _______________________________________________
> > Josué Alcalde González
> > jalcalde@csa.es
> > Dpto. Desarrollo
> >
> > CSA - Centro Regional de Servicios Avanzados
> > C/ López Bravo, 1
> > Pol. Ind. Villalonquéjar (Burgos)
> >
> > Tel. (+34) 947 256 250
> > Fax. (+34) 947 256 583
> >
> > Web: http://www.csa.es
> >
> >
> >
> >
>
--
_______________________________________________
Josué Alcalde González
jalcalde@csa.es
Dpto. Desarrollo
CSA - Centro Regional de Servicios Avanzados
C/ López Bravo, 1
Pol. Ind. Villalonquéjar (Burgos)
Tel. (+34) 947 256 250
Fax. (+34) 947 256 583
Web: http://www.csa.es
Re: File Download
Posted by omidh <om...@gmx.de>.
Referencing :
http://jsffaq.com/Wiki.jsp?ptitle=How+to+download+PDF+file+with+JSF%
3F&page=HowToDownloadPDFFileWithJSF
I would like to know if there is the possibility to resolve the contentType
"automatically"??
regards Omid.
Josué Alcalde González-2 wrote:
>
> El dom, 06-05-2007 a las 23:30 -0700, omidh escribió:
>> Hi,
>>
>> can anyone tell me please, how to make a link for a file download?!
>> The File is saved in a database (Mysql).
>>
>> so when I use <h:outputLink value="bean.file">
>> I get the message that the URL must be absolut.
>>
>> thansk in advance,
>> Omid
>
> There are diferent options:
>
> -Download it from an action method using command link or command button:
>
> http://jsffaq.com/Wiki.jsp?ptitle=How+to+download+PDF+file+with+JSF%
> 3F&page=HowToDownloadPDFFileWithJSF
>
> - Use a phaseListener to handle downloads of files:
> http://jroller.com/page/cagataycivici?entry=phaselistener_renders_an_image_no
>
>
>
> --
> _______________________________________________
> Josué Alcalde González
> jalcalde@csa.es
> Dpto. Desarrollo
>
> CSA - Centro Regional de Servicios Avanzados
> C/ López Bravo, 1
> Pol. Ind. Villalonquéjar (Burgos)
>
> Tel. (+34) 947 256 250
> Fax. (+34) 947 256 583
>
> Web: http://www.csa.es
>
>
>
>
--
View this message in context: http://www.nabble.com/File-Download-tf3702127.html#a10355004
Sent from the MyFaces - Users mailing list archive at Nabble.com.
Re: File Download
Posted by Josué Alcalde González <ja...@csa.es>.
El dom, 06-05-2007 a las 23:30 -0700, omidh escribió:
> Hi,
>
> can anyone tell me please, how to make a link for a file download?!
> The File is saved in a database (Mysql).
>
> so when I use <h:outputLink value="bean.file">
> I get the message that the URL must be absolut.
>
> thansk in advance,
> Omid
There are diferent options:
-Download it from an action method using command link or command button:
http://jsffaq.com/Wiki.jsp?ptitle=How+to+download+PDF+file+with+JSF%
3F&page=HowToDownloadPDFFileWithJSF
- Use a phaseListener to handle downloads of files:
http://jroller.com/page/cagataycivici?entry=phaselistener_renders_an_image_no
--
_______________________________________________
Josué Alcalde González
jalcalde@csa.es
Dpto. Desarrollo
CSA - Centro Regional de Servicios Avanzados
C/ López Bravo, 1
Pol. Ind. Villalonquéjar (Burgos)
Tel. (+34) 947 256 250
Fax. (+34) 947 256 583
Web: http://www.csa.es
Re: File Download
Posted by Scott O'Bryan <da...@gmail.com>.
Omid.. The link must be absolute. You can't just send a file located
in a backing bean directly to the browser. The url needs to be a web
resource and a backing bean is part of the model layer of Faces MVC
Architecture. My advice is to create a servlet whose job it is to
stream the file to the browser using the given content type. The link
would then reference that sevlet.
Hope that helps...
omidh wrote:
> Hi,
>
> can anyone tell me please, how to make a link for a file download?!
> The File is saved in a database (Mysql).
>
> so when I use <h:outputLink value="bean.file">
> I get the message that the URL must be absolut.
>
> thansk in advance,
> Omid
>