Hello All,
I want to generate Richfaces FileUpload on server side by java code and bind it in page. But I am not able to set the action method which get called when user uploads file through FileUpload.
This is what I did in my code,
HtmlFileUpload artattribComponentType = new HtmlFileUpload();
artattribComponentType.setId("testfileUpload");
artattribComponentType.setListWidth("150");
artattribComponentType.setListHeight("40");
// artattribComponentType.setAddControlLabel("Upload");
artattribComponentType.setMaxFilesQuantity(5);
artattribComponentType.setImmediateUpload(true);
//This is Important
MethodBinding action = FacesContext.getCurrentInstance().getApplication().createMethodBinding("#{massProductOrderGrid.uploadListener(fileUpload_" + idCnt + "_" + attribCount + ")}", new Class[] {});
artattribComponentType.setFileUploadListener(action);
By above code I am able to display RichFileUpload on page.
In Rich File upload there is one FileuploadListener method which get called when we upload the Image with the parameter as UploadEvent, but when
I am building the FileUpload on server, how do I set the UploadEvent of the uploadedd file.
My question is how do I set the UploadEvent of uploaded image in my fileListener method. Form that event I can get the Information abt uploaded file
Can anyone please guide me here what am I doing wrong?
Am I missing something obvious here?
Thanks and appreciate your response...
Hello,
Try to use
MethodBinding action = FacesContext.getCurrentInstance().getApplication().createMethodBinding("#{massProductOrderGrid.uploadListener(fileUpload_" + idCnt + "_" + attribCount + ")}", new Class[] {UploadEvent.class});