I'm using the latest version of RichFaces, I've copied the show case example on the RichFaces website, and the example does not invoke the listener, I tried everything, could anyone help me?
xhtml
<rich:fileUpload fileUploadListener="#{fileUploadBean.listener}"
id="upload" acceptedTypes="jpg, gif, png, bmp"
maxFilesQuantity="5">
<a4j:ajax event="uploadcomplete" execute="@none" render="info" />
</rich:fileUpload>
Bean
@ManagedBean
@SessionScoped
public class FileUploadBean implements Serializable {
private ArrayList<UploadedImage> files = new ArrayList<UploadedImage>();
public void paint(OutputStream stream, Object object) throws IOException {
stream.write(getFiles().get((Integer) object).getData());
stream.close();
}
public void listener(FileUploadEvent event) throws Exception {
System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& - LISTENER");
UploadedFile item = event.getUploadedFile();
UploadedImage file = new UploadedImage();
//file.setLength(item.getData().length);
file.setName(item.getName());
file.setData(item.getData());
files.add(file);
}
public String clearUploadData() {
files.clear();
return null;
}
public int getSize() {
if (getFiles().size() > 0) {
return getFiles().size();
} else {
return 0;
}
}
public long getTimeStamp() {
return System.currentTimeMillis();
}
public ArrayList<UploadedImage> getFiles() {
return files;
}
public void setFiles(ArrayList<UploadedImage> files) {
this.files = files;
}
}
Web.xml
<context-param>
<param-name>org.richfaces.fileUpload.maxRequestSize</param-name>
<param-value>10000000</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.fileUpload.createTempFiles</param-name>
<param-value>true</param-value>
</context-param>