8 Replies Latest reply on Apr 14, 2008 10:53 AM by Ilya Shaikovsky

    a4j:mediaOutput problem in firefox

    inv3r53 d Novice


      i have below code which displays an image .this can be refreshed using a a4j button.
      This works fine in IE6.
      i am facing a prob in firefox 2.0.0.x.first time image is displayed but on clicking refresh button it doesnt seem to show refreshed image.if i clear the fire fox cache then it seems to update correctly.

      Is this a bug in ajax4jsf? or am i missing somthg.

      <a4j:mediaOutput id="id_graph" element="img" cacheable="false" session="true" createContent="#{bean.paint}" value="#{imageCustomizer}" mimeType="image/png" />

        • 1. Re: a4j:mediaOutput problem in firefox
          Sergey Smirnov Master

          does the value attribute is changed during the requests?

          • 2. Re: a4j:mediaOutput problem in firefox
            inv3r53 d Novice

            the value attribute is not changed.It has some constants defined.-width,height,etc

            • 3. Re: a4j:mediaOutput problem in firefox
              Ilya Shaikovsky Master

              add some random prefics to value to prevent caching.

              • 4. Re: a4j:mediaOutput problem in firefox
                Sergey Smirnov Master

                What it the version of the RichFaces (Ajax4jsf), BTW? It was a bug sometime ago when cacheable="false" was ignored.

                • 5. Re: a4j:mediaOutput problem in firefox
                  inv3r53 d Novice

                  am using 3.1.2 GA.

                  adding random prefix to value , how?

                  currently ImageCustomizer has constants declared, do i create a private member in ImageCustomizer and assign it a random value in its getter?


                  u mean like this?

                  • 6. Re: a4j:mediaOutput problem in firefox
                    inv3r53 d Novice

                    ok..if value is varied every time then it works in Firefox.

                    • 7. Re: a4j:mediaOutput problem in firefox
                      Jay Postertz Newbie

                      After upload a new image, firefox not show the new image until you clear cache. works fine in IE. It is possible to make the value param dynamic?


                       acceptedTypes="jpg, gif, png, bmp" listHeight="60">
                       <f:facet name="label">
                       <h:outputText value="#{msg.rich_file_upload_label}"/>
                       <a4j:support event="onuploadcomplete" reRender="preview"/>
                      <rich:dataGrid value="#{fileUploadBean.files}" var="file" columns="1" rowKeyVar="row">
                       <a4j:commandLink action="#{fileUploadBean.clearUploadData}" reRender="upload,preview">
                       <a4j:mediaOutput cacheable="false"
                       rendered="#{fileUploadBean.size == 1}" element="img"
                       mimeType="image/jpeg" createContent="#{fileUploadBean.paint}"
                       value="#{row}" border="0" style="max-height:200px; max-width: 166px;"/>


                      public class FileUploadBean implements FileUploadBeanIF {
                       private ArrayList<File> files = new ArrayList<File>();
                       private int uploadsAvailable = 1;
                       private boolean autoUpload = true;
                       public int getSize() {
                       if (getFiles().size()>0){
                       return getFiles().size();
                       return 0;
                       public void remove(){}
                       public FileUploadBean() {
                       public void paint(OutputStream stream, Object object) throws IOException {
                       public void listener(UploadEvent event) throws IOException {
                       UploadItem item = event.getUploadItem();
                       File file = new File();
                       file.setUploadDate(new Date(System.currentTimeMillis()));
                       public String clearUploadData() {
                       return null;
                       public ArrayList<File> getFiles() {
                       return files;
                       public void setFiles(ArrayList<File> files) {
                       this.files = files;
                       public int getUploadsAvailable() {
                       return uploadsAvailable;
                       public void setUploadsAvailable(int uploadsAvailable) {
                       this.uploadsAvailable = uploadsAvailable;
                       public boolean isAutoUpload() {
                       return autoUpload;
                       public void setAutoUpload(boolean autoUpload) {
                       this.autoUpload = autoUpload;


                      public class File implements Serializable {
                       private String Name;
                       private long length;
                       private Date uploadDate;
                       private byte[] data;
                       public byte[] getData() {
                       return data;
                       public void setData(byte[] data) {
                       this.data = data;
                       public String getName() {
                       return Name;
                       public void setName(String name) {
                       Name = name;
                       public long getLength() {
                       return length;
                       public void setLength(long length) {
                       this.length = length;
                       public Date getUploadDate() {
                       return uploadDate;
                       public void setUploadDate(Date uploadDate) {
                       this.uploadDate = uploadDate;

                      • 8. Re: a4j:mediaOutput problem in firefox
                        Ilya Shaikovsky Master

                        please read above how it was fixed for daedlus ;)