2 Replies Latest reply on Aug 6, 2008 9:18 AM by Andrei Markavtsov

    File upload, renderRegionOnly problem

    Simon Cigoj Newbie

      I'm using
      - richfaces 3.2.1 GA
      - sun-ri implementation,
      - JRE1.5,
      - testing on Tomcat 6.0.

      Here is my code :

      <a4j:outputPanel rendered="#{!empty Bean1.str}">
       #{Bean1.str}
      </a4j:outputPanel>
      
      <a4j:region renderRegionOnly="true">
       <a4j:form id="f1" enctype="multipart/form-data" method="post">
       #{Bean1.str}
       <a4j:commandButton reRender="f1" value="f1"></a4j:commandButton>
       </a4j:form>
       <a4j:form id="f2" enctype="multipart/form-data" method="post">
       #{Bean2.str}
       <a4j:commandButton reRender="f2" value="f2"></a4j:commandButton>
       <rich:fileUpload fileUploadListener="#{Bean2.uploadListener}"
       maxFilesQuantity="2"
       immediateUpload="false"
       acceptedTypes="jpg, gif, png"
       >
       <a4j:support event="onuploadcomplete" reRender="f2" />
       </rich:fileUpload>
       </a4j:form>
      </a4j:region>


      When the page loads, it calls both beans constructor, then when the form f1 or f2 is submitted, only one bean is called. To achieve this behaviour, not to call baen1 when f2 is submitted, renderRegionOnly="true" must be used... otherwise outputPanel rendered cause to call Bean1. The problem is when upload button is pressed, Bean1 constructor is called.