0 Replies Latest reply on Oct 27, 2010 2:32 AM by Ioana Iacob

    mediaoutput dynamically generate iframe

    Ioana Iacob Newbie

      Hello,

       

      I'm trying to dynamically generate an iframe using a4j:mediaoutput (RichFaces version richfaces 3.3.3.Final, jboss 4.2.3 env.).

       

      I figured it should be something like this:

       

      HtmlAjaxOutputPanel mainPanel = new HtmlAjaxOutputPanel();
      mainPanel.setId(facesContext.getViewRoot().createUniqueId());
      MediaOutput mediaOutput = new MediaOutput();
      mediaOutput.setId("htmlRenderer");
      mediaOutput.setSession(true);
      mediaOutput.setCacheable(false);
      mediaOutput.setElement("iframe");
      mediaOutput.setMimeType("text/html");
      mediaOutput.setUriAttribute("src");
      MediaData data = new MediaData();
      data.setSrc("http://www.google.it");
      mediaOutput.setValue(data);
      mainPanel.getChildren().add(mediaOutput);
      HtmlAjaxOutputPanel mainPanel = new HtmlAjaxOutputPanel();
                mainPanel.setId(facesContext.getViewRoot().createUniqueId());
                     MediaOutput mediaOutput = new MediaOutput();
                     mediaOutput.setId("htmlRenderer");
                     mediaOutput.setSession(true);
                     mediaOutput.setCacheable(false);
                     mediaOutput.setElement("iframe");
                     mediaOutput.setMimeType("text/html");
                     mediaOutput.setUriAttribute("src");
                     MediaData data = new MediaData();
                     data.setSrc("http://www.google.it");
                     mediaOutput.setValue(data);
                mainPanel.getChildren().add(mediaOutput);
      

       

      The error I'm getting is:

      ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
      java.lang.NullPointerException
           at org.ajax4jsf.resource.UserResource.send(UserResource.java:110)
           at org.ajax4jsf.resource.ResourceLifecycle.sendResource(ResourceLifecycle.java:221)
      ...
      
      

       

      Any ideas?

      Thank you.