2 Replies Latest reply on Jun 7, 2013 7:19 PM by Brian Leathem

    rich:fileUpload with RichFaces4 does not refresh after upload

    Assen Todorov Newbie

      Hi,

       

      I use the demo-example code to implement file upload in my application.

      In the demo-example there are 2 tables :

      - left table for selection of file(s) to upload

      - right table for preview of already uploaded files together with information about the file (name and size)

      All works fine and I am able to store uploaded files on my local disk, but have problems with the preview-table.

      After upload the preview table get not refreshed/rerendered and I am not able to see the uploaded files.

      The strange thing is, that if I look into the source code of the page (in browser - right mouse click and select "view page source" ) I can see all the information in the preview table, but it seems not to be rendered and this information is not shown in the browser.

       

      Screenshots (see attachments) :

      • first - init state
      • second - file selected
      • third - file uploaded, progressbar not working, preview not refreshed/rerendered (looks like it is hanging, but the file is stored on the disk)
      • fourth - after manual refresh (F5) the preview table is refreshed, but the information from the left table is missing

       

      My markup looks as follows :

       

      <?xml version="1.0" encoding="UTF-8"?>
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                      xmlns:f="http://java.sun.com/jsf/core"
                      xmlns:ui="http://java.sun.com/jsf/facelets"
                      xmlns:a4j="http://richfaces.org/a4j"
                      xmlns:rich="http://richfaces.org/rich"
                      xmlns:p="http://primefaces.prime.com.tr/ui"
                      xmlns:h="http://java.sun.com/jsf/html"
                      template="/resources/templates/default.xhtml">
      
      
         <ui:define name="navigation">
            <ui:decorate template="navigation.xhtml">
               <ui:param name="pageId" value="application.overview"/>
            </ui:decorate>
         </ui:define>
      
      
         <ui:define name="content">
            <h:form>
               <h:panelGrid columns="2" columnClasses="top,top">
      
                  <rich:fileUpload fileUploadListener="#{fileUploadBean.listener}"
                                   id="upload" acceptedTypes="#{fileUploadBean.allowedMimeTypes}">
                     <a4j:ajax event="uploadcomplete" execute="@none" render="infoPanelGroup"/>
                  </rich:fileUpload>
      
                  <h:panelGroup id="infoPanelGroup" layout="block">
      
                     <rich:panel bodyClass="info">
                        <f:facet name="header">
                           <h:outputText value="Uploaded Files Info"/>
                        </f:facet>
                        <h:outputText value="No files currently uploaded"
                                      rendered="#{fileUploadBean.size==0}"/>
                        <rich:dataGrid columns="1" value="#{fileUploadBean.files}"
                                       var="file" rowKeyVar="row">
                           <rich:panel bodyClass="rich-laguna-panel-no-header">
                              <h:panelGrid columns="2">
                                 <a4j:mediaOutput element="img" mimeType="image/jpeg"
                                                  createContent="#{fileUploadBean.paint}" value="#{row}"
                                                  style="width:100px; height:100px;" cacheable="false">
                                    <f:param value="#{fileUploadBean.timeStamp}" name="time"/>
                                 </a4j:mediaOutput>
                                 <h:panelGrid columns="2">
                                    <h:outputText value="File Name:"/>
                                    <h:outputText value="#{file.name}"/>
                                    <h:outputText value="File Length(bytes):"/>
                                    <h:outputText value="#{file.length}"/>
                                 </h:panelGrid>
                              </h:panelGrid>
                           </rich:panel>
                        </rich:dataGrid>
                     </rich:panel>
                     <br/>
                     <a4j:commandButton action="#{fileUploadBean.clearUploadData}"
                                        render="infoPanelGroup, upload" value="Clear Uploaded Data"
                                        rendered="#{fileUploadBean.size > 0}"/>
                  </h:panelGroup>
               </h:panelGrid>
            </h:form>
         </ui:define>
      </ui:composition>
      
      

       

      Any ideas? I need help ...

       

      Edit:

      I use RF4 together with Seam 3. In my web.xml I have both parameters required for rich:fileUpload - org.richfaces.fileUpload.createTempFiles and org.richfaces.fileUpload.maxRequestSizes.