Based on the 4.x show case, I have:
fileupload.xhtml:
...
<rich:fileUpload fileUploadListener="#{fsBean.uploadListener}"
id="upload"
maxFilesQuantity="10">
<a4j:ajax event="uploadcomplete" execute="#{fsBean.doUpload()}" render="info" />
</rich:fileUpload>
...
fsBean:
@Named("fsBean")
@Scope("request")
public class FileServiceBean implements Serializable {
private List<BpFile> files = new ArrayList<BpFile>();
@Inject
private IFileService iFileService;
public void uploadListener(FileUploadEvent event) throws Exception {
System.out.println("uploadListener");
// get the uploaded file from richfaces
UploadedFile item = event.getUploadedFile();
// create the BpFile
BpFile file = new BpFile();
file.setLength(item.getData().length);
file.setName(item.getName());
file.setData(item.getData());
// add the file to upload list
files.add(file);
}
public void doUpload() {
System.out.println("doUpload()");
}
public void clearUploadData() {
files.clear();
}
......
I ran this webapp in tomcat7, when I was trying to open the page, I got the following error:
javax.el.PropertyNotFoundException: Property 'uploadListener' not found on type abc.xyz.FileServiceBean
Any one here could help please, I am totally new to everything. Thanks heaps in advance.