aspose file tools*
The moose likes JSF and the fly likes convert Bytes[] to StreamedContent fro download jsf2.0 primefaces3.3.1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "convert Bytes[] to StreamedContent fro download jsf2.0 primefaces3.3.1" Watch "convert Bytes[] to StreamedContent fro download jsf2.0 primefaces3.3.1" New topic
Author

convert Bytes[] to StreamedContent fro download jsf2.0 primefaces3.3.1

doinigly jaquel
Greenhorn

Joined: Aug 08, 2012
Posts: 6
hello
I use primefaces and I want to download a file with different formats(pdf, jpg, png, ) from database but I don't succed to realise this I have seen a lot of topic like this but their methods don't work for me here is the html :


and here is the java :

always, image.getContentType() return null and bytes.length not null

do you have any idea

thank you
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16055
    
  21

JSF is designed to work with HTML, not PDF, MS-Word/Excel files or other non-HTML data.

Instead of trying to force JSF to output stuff it wasn't intended to output, you'll find it's cleaner to use a JSF h:outputLink element to reference a servlet URL. Let the servlet handle outputting the special-format data.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: convert Bytes[] to StreamedContent fro download jsf2.0 primefaces3.3.1