7 Replies Latest reply on May 25, 2011 5:17 PM by Devin Wilson

    ReRender problem with mediaOutput

    Felipe Jaekel Newbie

      I have a page where I upload an image, and after upload it's displayed in a mediaOutput component.

      The problem is that after I send the first image the component isn't reRendered anymore. The method specified in the createContent attribute isn't called. The image is only show if I reload the page.

      <a4j:mediaOutput
       id="imagemGuia"
       element="img"
       cacheable="false"
       session="false"
       createContent="#{gestaoLogomarca.generateImagemGuia}"
       style="height:100px; width:200px"
      />
      
      <rich:fileUpload
       immediateUpload="true"
       id="uploadImagemGuia"
       ajaxSingle="true"
       listHeight="60"
       acceptedTypes="jpg,gif,png"
       addControlLabel="Enviar imagem"
       fileUploadListener="#{gestaoLogomarca.uploadImagemGuia}"
      >
       <a4j:support
       event="onuploadcomplete"
       reRender="imagemGuia"
       />
      </rich:fileUpload>
      


       public void generateImagemGuia(OutputStream out, Object data) throws IOException
       {
       if(logomarca.getImagemGuia() != null)
       {
       out.write(logomarca.getImagemGuia());
       }
       }
      


      I've also tried to flush and close the OutputStream after the initial render but nothing
       public void generateImagemGuia(OutputStream out, Object data) throws IOException
       {
       if(logomarca.getImagemGuia() != null)
       {
       out.write(logomarca.getImagemGuia());
       out.flush();
       out.close();
       }
       }
      


      Any ideias?

      Thanks,
      Felipe