p:graphicImage Bug

UI Components for JSF
Post Reply
Michel1143
Posts: 22
Joined: 09 Aug 2011, 18:54

06 Sep 2011, 00:56

Hello guys.
I'm currently trying on my project to show an dynamic image via p:graphicImage.
But it seems like it's not working on SessionScoped Managedbeans?
On RequestScope beans it works flawless. But after a reload with an ManagedBean the dynamic image is lost.
Oh and I get on every scenario this debug message:

Code: Select all

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

Here the code:
MyBean.java - ManagedBean

Code: Select all

@ManagedBean
@SessionScoped
public class MyBean {
    
    private InputStream myFile;
    private StreamedContent dbImage;

    public MyBean() {
        try {
            myFile = new BufferedInputStream(new FileInputStream("D:/2.gif"));
            if (myFile == null) {
                System.out.println("ERROR!");
            } else {
                dbImage = new DefaultStreamedContent(myFile, "image/gif");
            }
        } catch (FileNotFoundException ex) {
            System.out.println("ERROR22!");
        }
        
    }
....
}
index.xhtml

Code: Select all

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui">
    <h:head>
        <title>Facelet Title</title>
    </h:head>
    <h:body>
        Hello from Facelets<br />
        <br />
        <p:graphicImage value="#{myBean.dbImage}"/>
    </h:body>
</html>

Michel1143
Posts: 22
Joined: 09 Aug 2011, 18:54

06 Sep 2011, 19:30

Any idea?

Michel1143
Posts: 22
Joined: 09 Aug 2011, 18:54

07 Sep 2011, 19:26

nobody an idea? :(

barthelomeo
Posts: 14
Joined: 27 Jun 2011, 15:55

08 Sep 2011, 11:02

We discuss a similar problem here:

viewtopic.php?f=3&t=13391
PrimeFaces 3.0
Mojarra 2.1.4
Tomcat 7.0.22

Pontin
Posts: 5
Joined: 27 Oct 2011, 14:28
Location: Brasil

27 Oct 2011, 14:34

Here's the solution that saved me: viewtopic.php?f=3&t=4163&p=18672&hilit= ... age#p39751 :idea: ²
Mojarra JSF 2.0.3 | PrimeFaces 3.0.M4 | Apache Tomcat/7.0.5

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Carolinagc1985 and 27 guests