In a <rich:popupPanel /> I have a <rich:fileUpload /> which has a fileUploadListener defined as #{assemblyMB.listener}. This listener method is defined on the managed bean as:
public void listener(FileUploadEvent event) throws Exception {
System.out.println("listener");
}
on the JSF page I have:
<rich:fileUpload id="popupFileUpload"
fileUploadListener="#{assemblyMB.listener}"
onuploadcomplete="#{rich:component('popup')}.hide(); return false;"
</rich:fileUpload>
On the managed bean, I have declared the annotation @ManagedBean(name = “assemblyMB”).
I intend to access the method on the managed bean when the file is uploaded, but I’m failing to do so. I don’t understand why is that happening.
Can anybody throw me a light here? Thanks in advance,
gtludwig
Assuming RichFaces 4.0, all you need to ensure is that the parent
<h:form>is set to encode the request body asmultipart/form-data.This way the file should be uploaded properly and the listener method should be invoked when the upload has been arrived in the server side.