RF4 rich:fileUpload vs rich:tabPanel
dahm Sep 28, 2011 3:50 AMHi,
I've got a serious problem in a complex nested web application using Richfaces 4 on JBoss 7 (Mojarra 2.0.X):
Our application uses a lot of tabs where each tab contains complex nested data, such as an data tables, accordion and a
file upload component within the accordion in particular.
The behavior is that when I use the fileupload the very first time it works great. The uploaded image is added dynamically to
another tab as a thumbnail. There it can be clicked and displays a popup with the complete file.
But when I switch to another tab, then go back and try to upload another file, nothing happens. The listener is
not being called nor is the output panel being rerendered....
I'd appreciate any help...
Markus
The page causing problems looks like this:
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:a4j="http://richfaces.org/a4j" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:rich="http://richfaces.org/rich"> <rich:panel style="background-color: white;"> <ui:param name="artikel" value="#{tab.artikel}" /> <h:panelGrid columns="2" id="documentArea" columnClasses="topAlignedLeftArticleViewColumn,topAlignedRightColumn"> <h:panelGroup layout="block"> <rich:panel bodyClass="articleDocumentArea"> <f:facet name="header"> <h:outputText value="#{messages['devA.articleview.documentUpload']}" /> </f:facet> <h:form enctype="multipart/form-data"> <rich:fileUpload serverErrorLabel="#{messages['devA.articleview.errorUpload']}" sizeExceededLabel="#{messages['devA.documentSize.message']}" addLabel="#{messages['devA.articleview.addDocument']}" uploadLabel="#{messages['devA.articleview.upload']}" deleteLabel="#{messages['devA.articleview.delete']}" clearAllLabel="#{messages['devA.articleview.clearAll']}" clearLabel="#{messages['devA.articleview.clear']}" doneLabel="#{messages['devA.articleview.done']}" fileUploadListener="#{artikelDokumentController.uploadFile}" render="articleDocumentArea#{artikel.id}"> <!-- <a4j:ajax event="uploadcomplete" execute="@none" render="articleDocumentArea#{artikel.id}" /> --> </rich:fileUpload> <h:messages layout="list" styleClass="feedbackPanel" warnClass="warn-message" infoClass="info-message" errorClass="error-message" globalOnly="true" /> </h:form> </rich:panel> </h:panelGroup> <a4j:outputPanel id="articleDocumentArea#{artikel.id}" ajaxRendered="true"> <h:panelGroup layout="block"> <rich:panel bodyClass="articleDocumentArea"> <f:facet name="header"> <h:outputText value="#{messages['devA.articleview.documents']}" /> </f:facet> <h:outputText value="#{messages['devA.articleview.noDocuments']}" rendered="#{empty artikel.dokumente}" /> <h:panelGrid columns="5"> <c:forEach items="#{artikel.dokumente}" var="dokument"> <h:panelGroup rendered="#{dokument.image}" styleClass="documentCell"> <h:panelGroup> <h:commandLink> <rich:componentControl target="dokumentPopup#{tab.id}X#{dokument.id}" operation="show" /> <a4j:mediaOutput element="img" mimeType="#{dokument.contentType}" cacheable="true" createContent="#{dokumentController.loadThumbnail}" value="#{dokument.id}" /> </h:commandLink> <br /> <h:commandLink value="#{messages['devA.articleview.useAsDefaultImage']}" action="#{artikelDokumentController.setDefaultImage(dokument.id)}" /> </h:panelGroup> <h:form> <rich:popupPanel id="dokumentPopup#{tab.id}X#{dokument.id}" modal="false" autosized="true" resizeable="false"> <f:facet name="header"> <h:outputText value="#{dokument.name}" /> </f:facet> <f:facet name="controls"> <a href="#" onclick="#{rich:component('dokumentPopup'.concat(tab.id).concat('X').concat(dokument.id))}.hide(); return false;" style="color: white;">#{messages['devA.articleview.close']}</a> <h:outputLink value="#" onclick="#{rich:component('dokumentPopup'.concat(tab.id).concat('X').concat(dokument.id))}.hide(); return false;" style="color: white;"> X </h:outputLink> </f:facet> <p> <a4j:mediaOutput element="img" cacheable="false" session="true" createContent="#{dokumentController.loadDokument}" value="#{dokument.id}" mimeType="#{dokument.contentType}" alt="img" /> </p> </rich:popupPanel> </h:form> </h:panelGroup> <h:panelGroup rendered="#{not dokument.image}" styleClass="documentCell"> <a4j:mediaOutput title="#{dokument.name}" element="a" target="imageView" cacheable="false" session="true" fileName="#{dokument.name}" createContent="#{dokumentController.loadDokument}" value="#{dokument.id}" mimeType="#{dokument.contentType}" alt="Dokument" rendered="#{not dokument.image}"> <a4j:mediaOutput element="img" mimeType="#{dokument.contentType}" cacheable="true" createContent="#{dokumentController.loadThumbnail}" value="#{dokument.id}" /> </a4j:mediaOutput> </h:panelGroup> </c:forEach> </h:panelGrid> </rich:panel> </h:panelGroup> </a4j:outputPanel> </h:panelGrid> </rich:panel> </ui:composition>