2 Replies Latest reply on Sep 8, 2008 9:46 AM by lee64

    mediaOutput ajax rendered do not work

    lee64

      Hi,I've got some problem in using <a4j:mediaOutput> tag.

      target:
      click the "change" link,the authcode image refreshs.

      <a4j:outputPanel id="code">
      <a4j:mediaOutput element="img" cacheable="false" session="false"
       createContent="#{authcode.paint}" value="#{mediaData}" mimeType="image/jpeg" />
      </a4j:outputPanel>
      


      The problem is hao to design the "change" link.I've tried these(both are useless):

      <h:outputLink value="#">
      change
      <a4j:support event="onclick" reRender="code"/>
      </h:outputLink>
      


      <a4j:commandLink reRender="code">
      change
      </a4j:commandLink>
      


      I think the cause maybe the attribute "mediaData" do not change during every requst.
      Please offer me a solution,great thanks!

        • 1. Re: mediaOutput ajax rendered do not work
          ilya_shaikovsky

          Yes that because value doesn't gets changed - so browser gets resource from cache.

          in our application we've added next code to workaround this:

          demosite fileUpload example:
          1) page code

           <a4j:mediaOutput element="img" mimeType="#{file.mime}"
           createContent="#{fileUploadBean.paint}" value="#{row}"
           style="width:100px; height:100px;" cacheable="false">
           <f:param value="#{fileUploadBean.timeStamp}" name="time"/>
           </a4j:mediaOutput>
          
          


          Java bean code for timeStamp:
           public long getTimeStamp(){
           return System.currentTimeMillis();
           }
          
          
          


          In this case - should works fine.

          • 2. Re: mediaOutput ajax rendered do not work
            lee64

            Thank you! Now it works.
            Thanks again for your timely and efficient help!