title: How to set a bean property before uploading a file using rich:fileUpload?
body: <p>My application has a modal panel where the user can upload files and choose a "document type" in a drop-down select. </p>
  
  <p>I was using an <code>&lt;f:setPropertyActionListener&gt;</code> to set the document type value during the upload event, but sometimes the property is set <strong>after</strong> the upload has been processed. Probably it's happening because another request is being generated, and this request is handled by another web container thread.</p>
  
  <pre><code>&lt;rich:modalPanel id="attachFiles" autosized="true"&gt;
      &lt;h:form id="formUpload" enctype="multipart/form-data"&gt;
          &lt;h:selectOneMenu id="docType"  value="#{myMB.docType}" required="true" &gt;
              &lt;f:selectItems value="#{myMB.docTypesSelectItems}"  /&gt;
      &lt;/h:selectOneMenu&gt;`
          &lt;rich:fileUpload id="upload" fileUploadListener="#{myMB.handleUpload}"&gt;
              &lt;a4j:support event="onupload"&gt;
                  &lt;f:setPropertyActionListener value="#{myMB.docType}" 
                      target="#{myMB.docType}" /&gt;
              &lt;/a4j:support&gt;
          &lt;/rich:fileUpload&gt;
  &lt;/rich:modalPanel&gt;
  </code></pre>
  
  <p>When it happens, the value of <code>myMB.docType</code>is null during the execution of <code>myMB.handleUpload</code>, which is not expected, since the field is supposed to be required.</p>
  
  <p>Is there a way to assure that the method <code>myMB.handleUpload</code> is executed only <strong>after</strong> the property of <code>docType</code> has been set?</p>