Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm using streamedcontent to render a byte sent from JSF then send it back as a streamed content as following:

<p:graphicImage value="#{manage.bytesToStreamedContent(car.image)}"/>

where image is the byte array of the image stored in the database

backing bean:

public StreamedContent bytesToStreamedContent(byte[] bytes)
{
    InputStream is = new ByteArrayInputStream(bytes);
    StreamedContent image = new DefaultStreamedContent (is, "image/jpeg");
    return image;
}

But I'm not getting the image in the JSF page. I got this message appearing in the server log:

WARNING: JSF1091: No mime type could be found for file dynamiccontent. To resolve this, add a mime-type mapping to the applications web.xml.

and:

SEVERE: Error in streaming dynamic resource.

can you please help me out here, I cant find any useful info regarding this issue

PS:

Im using the following libraries:

Mojarra 2.1.3

PrimeFaces 3.1.1

Glassfish 3.1

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.1k views
Welcome To Ask or Share your Answers For Others

1 Answer

Found where the problem was. The problem wasn't in the graphicimage. It was because the graphicimage tag is being loaded dynamically (similar issue when trying loading from datatable). Dynamic images cannot be rendered directly in datatable or datagrid. (Workaround is to assign a param and bring the images from the id).

However, the solution is here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...