3 Replies Latest reply on Mar 5, 2012 2:29 AM by palbergan

    rich:fileUpload behaviour

    palbergan

      I'm using the rich:fileUpload component. There is a lot of documentation for the 3.x version but for 4.x the documentation seems to lack. I have used it in both an form and a modal dialog. In the modal form the 'upload' button does not trigger any action if the modal dialog has only been opened and closed once before. If I open it for a third time it works again.

       

      I have tried some of the Java scripts documented for 3.x but they dont work for 4.x. I would like to do some checks on the internal file list, 'component.entries' when debugging my case but it does not work.

       

      Any suggestions on where to find documentation for it and examples like those for 3.x.

        • 1. Re: rich:fileUpload behaviour
          pvito

          Hi,

           

          try set properties domElementAttachment="form" in rich:popupPanel,

          like this:

           

          <h:form>

          <rich:popupPanel domElementAttachment="form" modal="true">

          </rich:popupPanel>

          <h:form>

          • 2. Re: rich:fileUpload behaviour
            palbergan

            Thanks for the answer. I have now investigated further on the problem. I turns out that my problem has nothing to do with the modal panel. It has to do with composite components. In order to see the problem do as follows:

             

            1. Click 'UPLOAD' to show the file upload component.

            2. Click the 'Add' button and select a file.

            3. Click the 'Close' button to hide the file upload component.

            4. Click 'UPLOAD'.

            5. Click the 'Add' button and select a file.

            6. Click the 'Upload' button in the file upload component.

             

            As you can see nothing happens. The component does not do anything. If you skip 3,4 and 5 the file is uploaded. Very odd.

             

            Here is the component code:

             

            <?xml version="1.0" encoding="UTF-8"?>

            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

            <html xmlns="http://www.w3.org/1999/xhtml"

            xmlns:cc="http://java.sun.com/jsf/composite"

            xmlns:rich="http://richfaces.org/rich"

            xmlns:f="http://java.sun.com/jsf/core"

            xmlns:h="http://java.sun.com/jsf/html">

            <cc:interface>

            <cc:attribute name="showButton" default="true"/>

            </cc:interface>

            <cc:implementation>

            <h:commandButton id="uploadFile" value="UPLOAD"

            disabled="#{!cc.attrs.showButton}">

            <f:ajax execute="@this" render="fileUploadPanel" />

            <f:setPropertyActionListener value="true"

            target="#{fileUploadBean.show}" />

            </h:commandButton>

            <h:panelGroup id="fileUploadPanel">

            <h:panelGroup rendered="#{fileUploadBean.show}">

            <rich:fileUpload id="fileUpload" acceptedTypes="txt"

            fileUploadListener="#{fileUploadBean.uploadDone}">

            <f:ajax execute="@form" event="uploadcomplete"

            listener="#{fileUploadBean.uploadCompleted}" render="" />

            </rich:fileUpload>

            <h:commandButton id="close" value="Close">

            <f:ajax execute="@this" render="fileUploadPanel" />

            <f:setPropertyActionListener value="false"

            target="#{fileUploadBean.show}" />

            </h:commandButton>

            </h:panelGroup>

            </h:panelGroup>

            </cc:implementation>

            </html>

             

             

            //*********************Components use file**********

            <?xml version="1.0" encoding="UTF-8"?>

            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

            <html xmlns="http://www.w3.org/1999/xhtml"

            xmlns:showcase="http://java.sun.com/jsf/composite/showcase"

            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:scomp="http://www.skd.no/jsf/composite"

            xmlns:sfunk="http://www.skd.no/jsf/funksjoner">

            <body>

            <ui:component>

            <h:form id="form">

            <showcase:demoComponent id="uploadFile"/>

            </h:form>

            </ui:component>

            </body>

            </html>

            • 3. Re: rich:fileUpload behaviour
              palbergan

              I have today installed Richfaces 4.2.0.Final version and now all problems with the component is solved. Now it also understand the MaxFilesQuantity parameters and internal lists are reset correct it seems when downloading the same file twice. Finally my problems are solved!

              1 of 1 people found this helpful