user2401147
user2401147

Reputation: 11

Rich faces 4.2.3 file upload not invoking backing bean method

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");
    }
}

Upvotes: 0

Views: 845

Answers (1)

udaikumar26
udaikumar26

Reputation: 7

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

Upvotes: 1

Related Questions