1 Reply Latest reply on Apr 30, 2013 8:29 AM by patch_78

    How to call bean method after finish file upload

    patch_78

      Hi,

       

      Can anyone please suggest me how I can call a method on my bean after the file uploading finish ?

      I used actionListener on ajax:ajax but it does not work!

       

      My xhtml:

       

                  <rich:fileUpload fileUploadListener="#{fileUploadBean.listener}" id="upload"

                      maxFilesQuantity="50">

                      <a4j:ajax event="uploadcomplete" render="localHttpPNL" actionListener="#{addDatasetBean.afterFilesUpload}" />

                  </rich:fileUpload>

       

      My bean:

          

                private void afterFilesUpload(ActionEvent event) {

                     //

                     // doing some tasks

                }

       

      Thanks!

      patch

        • 1. Re: How to call bean method after finish file upload
          patch_78

          I found a solution. I have to use parameter 'listener' not 'actionListener' like:

           

                      <rich:fileUpload fileUploadListener="#{fileUploadBean.listener}" id="upload"

                          maxFilesQuantity="50">

                          <a4j:ajax event="uploadcomplete" render="localHttpPNL" listener="#{addDatasetBean.afterFilesUpload}" />

                      </rich:fileUpload>

           

          Also the method takes AjaxBehaviorEvent argument like:

           

                    public void afterFilesUpload(AjaxBehaviorEvent event) {

                         //

                         // doing some tasks

                    }

           

          patch