the fileUploadListener method is not fired. I'm using code from the Primefaces showcase:
Here is my jsf code:
<h:form enctype="multipart/form-data">
<p:fileUpload mode="simple" value="#{uploadBean.file}" />
<p:commandButton value="Upload" action="#{uploadBean.upload}" ajax="false" />
</h:form>
Here is my bean code:
@ManagedBean(name="uploadBean")
public class UploadBean {
private UploadedFile file;
public UploadedFile getFile() {
return file;
}
public void setFile(UploadedFile file) {
this.file = file;
}
public void upload() {
System.out.println("--->tipofile"+ file);
if(file != null) {
FacesMessage message = new FacesMessage("Succesful", file.getFileName() + " is uploaded.");
FacesContext.getCurrentInstance().addMessage(null, message);
}
}
Is there anything wrong? I haven't configured any xml as I'm currently using Primefaces 5.2
EDIT: The same question was asked before. As noone of the answers solves my problem, I thought that maybe it has to do with the PF version I'm using How to use PrimeFaces p:fileUpload? Listener method is never invoked or UploadedFile is null
EDIT2: Trying debugging as suggested in the duplicated question I note: The Network section is fine. FileUploadRenderer#decode() is not called. My Upload() method is not called with enctype="multipart/form-data". I'll now try to see why upload is not called with enctype="multipart/form-data".