1 Reply Latest reply on May 20, 2010 9:30 AM by madsph

    a4j:support rerendering problem

      I am creating a portlet for uploading files using the rich:fileUpload component. After uploading I want to rerender part of the page using a4j:support.

       

      My environment is portletbridge 2.0.0.GA on GateIn 3.0.0.GA.

      I have created a seam portlet project using the maven archetype

       

      What I have done is basically copied the example from the livedemo exadel page:

       

      <h:form enctype="multipart/form-data">
                  <h:panelGrid columns="2" columnClasses="top,top">
                      <rich:fileUpload fileUploadListener="#{fileUploadBean.listener}"
                                       maxFilesQuantity="#{fileUploadBean.uploadsAvailable}"
                                       id="upload"
                                       immediateUpload="#{fileUploadBean.autoUpload}" 
                                       acceptedTypes="jpg, gif, png, bmp" allowFlash="#{fileUploadBean.useFlash}">
                          <a4j:support event="onuploadcomplete" reRender="info" />
                      </rich:fileUpload>
                      <a:outputPanel id="info">
                          <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="#{file.mime}"
                                                           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>
                          <rich:spacer height="3"/>
                          <br />
                          <a4j:commandButton action="#{fileUploadBean.clearUploadData}"
                                             reRender="info, upload" value="Clear Uploaded Data"
                                             rendered="#{fileUploadBean.size>0}" />
                      </a:outputPanel>
                  </h:panelGrid>
              </h:form>

       

      The upload part seems to work fine - at least my FileUploadBean receives the upload event containing the file data. The problem is when rerendering the info panal that displays the uploaded files. In stead of rerendering part of the page, my whole page is reloaded (or rerendered I can't really tell) and all I get is an xml header snippet

      <?xml version="1.0"?>

      which I assume was intended for the javascript.

       

      Any clues what I am missing in my setup.