I\'m trying to upload a file using PrimeFaces, but the fileUploadListener
method isn\'t being invoked after the upload finishes.
Here is the view:
bean.xhtml
Bean.java
@ManagedBean
@ViewScoped public class Submission implements Serializable {
private UploadedFile file;
//Gets
//Sets
public void uploadFasta(FileUploadEvent event) throws FileNotFoundException, IOException, InterruptedException {
String content = IOUtils.toString(event.getFile().getInputstream(), "UTF-8");
String filePath = PATH + "resources/submissions/" + nameOfMyFile + ".pdf";
MyFileWriter.writeFile(filePath, content);
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO,
event.getFile().getFileName() + " is uploaded.", null);
FacesContext.getCurrentInstance().addMessage(null, message);
}
}
web.xml
Faces Servlet
*.xhtml
PrimeFaces FileUpload Filter
org.primefaces.webapp.filter.FileUploadFilter
PrimeFaces FileUpload Filter
Faces Servlet