0 Replies Latest reply on Dec 1, 2010 2:29 AM by Bou BouBou

    mediaOutput example from core-demo RF4-M4

    Bou BouBou Newbie



      I have tried examples from core-demo provided in the archive of the RF4-M4 and most of them work.


      I still have an error with the MediaOuputBean:

      javax.el.ELException: /mediaOutput.xhtml @13,20 createContent="#{mediaOutputBean.createContent}": java.lang.NullPointerException


      Here is the code from the java Bean:

      @ManagedBean(name = "mediaOutputBean")
      public class MediaOutputBean {
          public void createContent(OutputStream os, Object data) {
              ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
              InputStream stream = classLoader.getResourceAsStream("org/richfaces/demo/" + data);


              try {
                  Util.copyStreamContent(stream, os);
              } catch (IOException e) {


                  // TODO Auto-generated catch block
              } finally {
                  try {
                  } catch (IOException e) {


                      // TODO Auto-generated catch block


      Here is the code from mediaOutput.xhtml:

      <a4j:mediaOutput createContent="#{mediaOutputBean.createContent}" value="richfaces.jpg"
                  element="img" /><br />
                  <a4j:mediaOutput createContent="#{mediaOutputBean.createContent}" value="richfaces-twitter.jpg"
                      element="img" >
                          <f:ajax event="dblclick" listener="#{commandBean.listener}" />
                  </a4j:mediaOutput><br />



      I have cheked that the files "richfaces.jpg", "richfaces-twitter.jpg" are in the folder "resources/org/richfaces/demo".


      Can you help me please?


      Best regards,