5 Replies Latest reply on Sep 25, 2008 9:57 AM by damatrix

    a4j:mediaOutput not called

    damatrix

      Hi,
      I'm using an a4j:mediOutput control in a facelet on a Spring Web Flow 2 application.

      I pass a bean containing a byte[] array image to the mediaOutput control to render. However i find that my "createContent" method is never called when i set break points in a debugger, and so the image is never rendered. Is there anything i'm missing?

        • 1. Re: a4j:mediaOutput not called
          nbelaevski

          Edem,

          Please post full page code and bean.

          • 2. Re: a4j:mediaOutput not called
            nbelaevski

            Bean and page code I really meant to say

            • 3. Re: a4j:mediaOutput not called
              damatrix

              Here is the facelet.

              <ui:composition xmlns="http://www.w3.org/1999/xhtml"
               xmlns:ui="http://java.sun.com/jsf/facelets"
               xmlns:h="http://java.sun.com/jsf/html"
               xmlns:f="http://java.sun.com/jsf/core"
               xmlns:rich="http://richfaces.org/rich"
               xmlns:a4j="http://richfaces.org/a4j"
               xmlns:sf="http://www.springframework.org/tags/faces">
              
               <div style="float:left">
               <rich:panel styleClass="sample" style="float:left">
               <a4j:mediaOutput id="picture" element="img" createContent="#{pictureOutput.drawImage}" value="#{subject.photo} mimeType="image/jpeg" >
              
               </a4j:mediaOutput>
               </rich:panel>
              </ui:composition>
              

              And here's the createContent method in my PictureOutput class

               public void drawImage(OutputStream out,Object data)throws IOException{
               if(data instanceof byte[]){
               byte[] photo = (byte[])data;
               if (photo.length>0) {
               out.write(photo);
               }
               }
               }
              


              The value to the mediaOutput control ie. "subject.photo" is a byte[].

              • 4. Re: a4j:mediaOutput not called
                abelevich

                Hello damatrix,

                I can't reproduce your bug.

                • 5. Re: a4j:mediaOutput not called
                  damatrix

                  Hi,
                  I still haven't been able to resolve my issue. You said you couldn't reproduce the bug. Did you test with a Spring Web Flow 2 application? If so can you bundle up yours for me to see what I'm doing wrong?

                  I don't know if my "subject" object is not being found in the scopes of Spring Web Flow so it can render the byte[] field. I really need some help here.