0
votes

I am trying to use richfaces file upload and the fileUploadListener is not invoking the listener in my backingbean.

Code in my xthml

 <rich:fileUpload fileUploadListener="#{fileUploadBackingBean.uploadFile}"
                maxFilesQuantity="#{fileUploadBackingBean.uploadsAvailable}"
                id="uploadfls" 
                immediateUpload="#{fileUploadBackingBean.autoUpload}"
                acceptedTypes="pdf,vnd.ms-excel,msexcel,xls" allowFlash="#{fileUploadBackingBean.useFlash}">
</rich:fileUpload>

BackingBean code

@ManagedBean(name = "fileUploadBean")
public class FileUploadBean {


public void listener(FileUploadEvent event) throws Exception {
    System.out.println("listener");
    }
}
1
I hope that you have at least a h:form and also tested with some output texte other than empty println();Alexandre Lavoie

1 Answers

1
votes

As shown in your code, the method you bound to the file upload component is "uploadFile" but the listener you provided in fileUploadBean is having the name "listener". It should have been, fileUploadListener="#{fileUploadBean.listener}"

Check below example, http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=fileUpload